我目前有一個問題,調整此工具提示插件。jQuery - 功能設置
(function($) {
$.fn.toolTip = function() {
$(this).hover(function() {
tip = $('.userRank');
tip.show();
}, function() {
tip.delay(2000).fadeOut('fast');
}).mousemove(function(e) {
var mousex = e.pageX - 32;
var mousey = e.pageY - 86;
var tipWidth = tip.width();
var tipHeight = tip.height();
var tipVisX = $(window).width() - (mousex + tipWidth);
var tipVisY = $(window).height() - (mousey + tipHeight);
if (tipVisX < 20) {
mousex = e.pageX - tipWidth - 20;
}
if (tipVisY < 20) {
mousey = e.pageY - tipHeight - 55;
}
tip.css({ top: mousey, left: mousex }).stop();
});
};
})(jQuery);
,你可以看到我已經通過tip可變
tip = $('.userRank');
限定的尖端容器或元件是有可以通過設置或選項,使得其看起來像任選地選擇的元素的可能性這個。
$('.bidInput').toolTip('#socialIcons');
或
$('.bidInput').toolTip({tip : '#socialIcons'});
我猜你讀過這個嗎? http://docs.jquery.com/Plugins/Authoring#Defaults_and_Options – Filip