1
我是jQuery UI新手。jQuery UI多選工具提示正在崩潰
我試圖創建一個可選 jQuery UI工具提示。工具提示與頁面上的鏈接相關聯。
當鏈接被文本包圍時,它可以正常工作。但是當相鄰的鏈接很少時,功能就會重疊並且工具提示不再流暢地顯示。
你可以找到http://jsfiddle.net/zumot/Hc3FK/2/
下面的JavaScript代碼
$("[title][data-scan]").bind("mouseleave", function (event) {
event.stopImmediatePropagation();
var fixed = setTimeout('$("[title][data-scan]").tooltip("close")', 100);
$(".ui-tooltip").click(function() {
alert("I am clickable");
return false;
});
$(".ui-tooltip").hover(
function() {
clearTimeout(fixed);
},
function() {
$("[title][data-scan]").tooltip("close");
});}).tooltip({
items: "img, [data-scan], [title]",
content: function() {
var element = $(this);
if (element.is("[data-scan]")) {
var text = element.attr("href");
return "<a href='http://www.google.com'>You are trying to open a tooltip <span>" + text + "</span></a>";
}
if (element.is("[title]")) {
return element.attr("title");
}
if (element.is("img")) {
return element.attr("alt");
}
},
position: {
my: "right center",
at: "left center",
delay: 200,
using: function (position, feedback) {
$(this).css(position);
$("<div>")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}});