May 2017
Intermediate to advanced
448 pages
10h 10m
English
In addition to being destroyed completely, any widget can be temporarily disabled and later re-enabled. The base widget methods, enable and disable, help us by setting the value of this.options.disabled to true or false as appropriate. All we have to do to support these methods is to check this value before our widget takes any action:
_open() { if (this.options.disabled) { return; } const elementOffset = this.element.offset(); this._tooltipDiv .css({ position: 'absolute', left: elementOffset.left, top: elementOffset.top + this.element.height() }) .text(this.element.data('tooltip-text')) .show();}
With this extra check in place, the tooltips stop displaying once .tooltip('disable') is called and ...
Read now
Unlock full access