May 2017
Intermediate to advanced
448 pages
10h 10m
English
A great plugin not only extends jQuery, but also offers plenty of opportunities for other code to extend the plugin itself. One simple way to offer this extensibility is to support a set of custom events related to the plugin. The widget factory makes this process straightforward:
_open() { if (this.options.disabled) { return; } const elementOffset = this.element.offset(); this._tooltipDiv .css({ position: 'absolute', left: elementOffset.left + this.options.offsetX, top: elementOffset.top + this.element.height() + this.options.offsetY }) .text(this.options.content(this.element)) .show(); this._trigger('open');},_close: function() { this._tooltipDiv.hide(); this._trigger('close'); }
Calling this._trigger() ...
Read now
Unlock full access