jQuery實(shí)現(xiàn)鏈接的title快速出現(xiàn)的方法
具體代碼如下所示:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>login</title> <script type="text/javascript" src="jquery.min.js"></script> </head> <style> body{ margin:0; padding:40px; background:#fff; font:80% Arial, Helvetica, sans-serif; color:#555; line-height:180%; } p{ clear:both; margin:0; padding:.5em 0; } #tooltip{ position:absolute; border:1px solid #333; background:#f7f5d1; padding:1px; color:#333; display:none; } </style> <body> <p><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip" title="這是我的超鏈接提示1">提示1</a></p> <p><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip" title="這是我的超鏈接提示2">提示2</a></p> <p><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="這是自帶提示1">自帶提示1</a></p> <p><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="這是自帶提示2">自帶提示2</a></p> <script> $(function () { $("a.tooltip").mouseover(function(e){ var tooltip="<div id='tooltip'>"+this.title+"</div>"; $("body").append(tooltip); $("#tooltip") .css({ "top":e.pageY+"px", "left":e.pageX+"px" }).show("fast"); }).mouseout(function(){ $("#tooltip").remove(); }); }); </script> </body> </html>
jQuery 事件 - pageY 屬性
顯示鼠標(biāo)指針的位置
show() 方法
顯示所有隱藏的 <p> 元素:
注意:show() 適用于通過 jQuery 方法和 CSS 中 display:none 隱藏的元素(不適用于通過 visibility:hidden 隱藏的元素)。
JQuery中這個(gè)function(e)那個(gè)e是什么意思?
回答一:e是事件,在firefox中只能在事件現(xiàn)場(chǎng)使用window.event,所以只有把event傳給函數(shù)使用。為了兼容FF和其它瀏覽器,一般會(huì)在函數(shù)里重新給e賦值:
e = window.event || e;
也就是說,如果window.event存在,則該瀏覽器支持直接使用window.event,否在就是不支持,不支持就使用傳進(jìn)來的e。
回答二:事件對(duì)象event 和我們普通寫的 <input type="text" onclick = "aaa(event)">
中的這個(gè)event一模一樣
jquery里邊的事件綁定函數(shù)中的參數(shù)e 都是在框架中給處理好了的 兼容各種瀏覽器。
以上所述是小編給大家介紹的jQuery實(shí)現(xiàn)鏈接的title快速出現(xiàn),希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
Jquery屬性的獲取/設(shè)置及樣式添加/刪除操作技巧分析
這篇文章主要介紹了Jquery屬性的獲取/設(shè)置及樣式添加/刪除操作技巧,結(jié)合實(shí)例形式分析了jquery針對(duì)屬性與樣式的相關(guān)獲取、設(shè)置、添加、刪除等相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下2019-12-12JQuery Tips(4) 一些關(guān)于提高JQuery性能的Tips
如今咱祖國(guó)已經(jīng)崛起了..電腦的配置也是直線上升.可是js的性能問題依然不可小覷..尤其在萬惡的IE中..js引擎速度本來就慢..如果JS如果再寫不好,客戶端多開幾個(gè)窗口假死肯定是家常便飯了.廢話不說了,下面說說js性能提升的一些小Tips.2009-12-12jQuery html() in Firefox (uses .innerHTML) ignores DOM chang
Firefox doesn't update the value attribute of a DOM object based on user input, just its valueproperty - pretty quick work around exists.2010-03-03jquery的flexigrid無法顯示數(shù)據(jù)提示獲取到數(shù)據(jù)
升級(jí)了IE10,發(fā)現(xiàn)flexigrid無法顯示數(shù)據(jù),提示獲取到了數(shù)據(jù),但沒任何報(bào)錯(cuò)任何顯示,經(jīng)過試驗(yàn)和跟蹤,修改如下,有類似問題的朋友可以參考下哈2013-07-07基于jQuery排序及應(yīng)用實(shí)現(xiàn)Tab欄特效
這篇文章主要介紹了基于jQuery排序及應(yīng)用實(shí)現(xiàn)Tab欄特效,jquery是基于JavaScript語言寫出來的一個(gè)框架,它封裝JavaScript常用的功能代碼,提供一種簡(jiǎn)便的JavaScript設(shè)計(jì)模式,但實(shí)質(zhì)上還是js,所以JQuery也屬于網(wǎng)頁編程語言。下面更多內(nèi)容需要的小伙伴可以參考一下2022-03-03JQuery+Bootstrap 自定義全屏Loading插件的示例demo
這篇文章主要介紹了JQuery+Bootstrap 自定義全屏Loading插件,本文通過示例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下2019-07-07