2
我們已經將jquery ui工具提示擴展到了自定義小部件。我們需要進一步擴展這一點,而不必觸及自定義小部件。我很難得到這個工作。請幫忙。擴展已擴展的jqueryUI工具提示小部件
(function ($) {
var extensionMethods = {
open: function() {
var childElem = target.children('img');
if (childElem.length) {
childElem.data('alt', childElem.attr('alt'));
childElem.removeAttr('alt');
}
$ui.tooltip.prototype.open.apply(this, arguments);
console.log("extension open works!");
},
close: function() {
var childElem = target.children('img');
if (childElem.data('alt')) {
childElem.attr('alt', childElem.data('alt'));
}
$ui.tooltip.prototype.close.apply(this, arguments);
console.log("extension close works!");
},
}
var methods = $.extend(true, {}, $.ui.tooltip.prototype, extensionMethods);
$.widget('my.customtooltip', methods);
})(jQuery);