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);