UNPKG

shave

Version:

Shave is a javascript plugin that truncates multi-line text within a html element based on set max height

26 lines (22 loc) 460 B
import shave, { Opts } from './shave' interface Plugin { fn: { shave: (maxHeight: number, opts?: Opts) => void } } declare global { interface Window { $: Plugin jQuery: Plugin Zepto: Plugin } } if (typeof window !== 'undefined') { const plugin = window.$ || window.jQuery || window.Zepto if (plugin) { plugin.fn.shave = function shavePlugin(maxHeight, opts) { shave(this, maxHeight, opts) return this } } }