Javascript代码
簡介
用簡單的jquery CSS建立自訂的a標籤title提示,用來取代瀏覽器預設行為。如圖:
Javascript代碼
$(function() { <br>$("a[title]").each(function () { <br>var a = $(this); <br>var title = a.attr('title'); <br>if (title == undefined || title == "") return; <br>a.data('title', title) <br>.removeAttr('title') <br>.hover( <br>function () { <br>var offset = a.offset(); <br>$ ("<div id="anchortitlecontainer"></div>").appendTo($("body")).html(title).css({ top: offset.top a.outerHeight() 10, left: offset .left a.outerWidth() 1 }).fadeIn(function () { <br>var pop = $(this); <br>setTimeout(function () { pop.remove(); }, pop.text() .length*80); <br>}); <br>}, <br>function() { $("#anchortitlecontainer").remove(); } <br>); <br>}); <br>}); <br>