基于jQuery實(shí)現(xiàn)點(diǎn)擊彈出層實(shí)例代碼
jquery實(shí)現(xiàn)點(diǎn)擊鏈接彈出層效果:本例實(shí)現(xiàn)的主要原理:jquery操作DOM元素。對(duì)層樣式的設(shè)置。將display:設(shè)置為none;讓層隱藏;
代碼實(shí)例如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.dbjr.com.cn" /> <title>子選擇器</title> <style type="text/css"> #choice_list_district{ height:50px; } #tab td{ cursor:pointer; } #divobj{ position:absolute; width:200px; height:200px; background:blue; border:1px solid block; display:none; z-index:9999; } </style> <script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script> <script type="text/javascript"> $(function (){ $("#choice_list_district a").click(function(e){ if($("#divobj").css("display")=="none"){ e.stopPropagation(); var offset=$(e.target).offset(); $("#divobj").css({top:offset.top+$(e.target).height()+"px",left:offset.left}); $("#divobj").show(); } else{ $("#divobj").hide(); } }); $(document).click(function(event){ $("#divobj").hide(); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <div id="choice_list_district"> <a href="#">出來(lái)層</a> </div> <div id="divobj"></div> </div> </form> </body> </html>
以上代碼中,點(diǎn)擊鏈接可以彈出隱藏的層,再點(diǎn)擊任何地方就可以隱藏此層。
本段代碼簡(jiǎn)單易懂,寫(xiě)的不好還請(qǐng)各位大俠見(jiàn)諒,希望本文分享能夠給大家?guī)?lái)幫助。
- jquery實(shí)現(xiàn)點(diǎn)擊彈出帶標(biāo)題欄的彈出層(從右上角飛入)效果
- jquery原創(chuàng)彈出層折疊效果點(diǎn)擊折疊彈出一個(gè)層
- jquery實(shí)現(xiàn)點(diǎn)擊彈出層效果的簡(jiǎn)單實(shí)例
- Jquery利用mouseenter和mouseleave實(shí)現(xiàn)鼠標(biāo)經(jīng)過(guò)彈出層且可以點(diǎn)擊
- 點(diǎn)擊彈出層效果&彈出窗口后網(wǎng)頁(yè)背景變暗效果的實(shí)現(xiàn)代碼
- jQuery點(diǎn)擊自身以外地方關(guān)閉彈出層的簡(jiǎn)單實(shí)例
- js 點(diǎn)擊頁(yè)面其他地方關(guān)閉彈出層(示例代碼)
- 點(diǎn)擊彈出層外區(qū)域關(guān)閉彈出層jquery特效示例
- JavaScript 點(diǎn)擊頁(yè)面上的按紐,彈出層,背景變灰
- js點(diǎn)擊任意區(qū)域彈出層消失實(shí)現(xiàn)代碼
相關(guān)文章
jQuery實(shí)現(xiàn)滑動(dòng)開(kāi)關(guān)效果
這篇文章主要為大家詳細(xì)介紹了jQuery實(shí)現(xiàn)滑動(dòng)開(kāi)關(guān)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-08-08用jQuery實(shí)現(xiàn)的智能隱藏、滑動(dòng)效果的返回頂部代碼
這篇文章主要介紹了用jQuery實(shí)現(xiàn)的智能隱藏、帶滑動(dòng)效果的返回頂部代碼,非常實(shí)用,需要的朋友可以參考下2014-03-03jQuery 動(dòng)態(tài)酷效果實(shí)現(xiàn)總結(jié)
jQuery是一個(gè)優(yōu)秀的JavaScript框架,可以很好的解決不同瀏覽器兼容的問(wèn)題,尤其是在ASP.NET MVC下,它的作用更加的凸顯。2009-12-12

jquery實(shí)現(xiàn)圖片漸變切換兼容ie6/Chrome/Firefox

詳談jQuery Ajax(load,post,get,ajax)的用法