jQuery實(shí)現(xiàn)打開(kāi)網(wǎng)頁(yè)自動(dòng)彈出遮罩層或點(diǎn)擊彈出遮罩層功能示例
本文實(shí)例講述了jQuery實(shí)現(xiàn)打開(kāi)網(wǎng)頁(yè)自動(dòng)彈出遮罩層或點(diǎn)擊彈出遮罩層功能。分享給大家供大家參考,具體如下:
彈出層:兩種方式
一是打開(kāi)網(wǎng)頁(yè)就自動(dòng)彈出層
二是點(diǎn)擊彈出
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>www.dbjr.com.cn - jQuery簡(jiǎn)便實(shí)現(xiàn)遮罩層</title> <meta charset="utf-8"> <style> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0; } #main { height:1800px; padding-top:90px; text-align:center; } #fullbg { background-color:gray; left:0; opacity:0.8; position:absolute; top:0; z-index:3; filter:alpha(opacity=80); -moz-opacity:0.5; -khtml-opacity:0.5; } #dialog { background-color:#fff; border:5px solid rgba(0,0,0, 0.8); height:400px; left:50%; margin:-200px 0 0 -200px; padding:1px; position:fixed !important; /* 浮動(dòng)對(duì)話框 */ position:absolute; top:50%; width:400px; z-index:5; border-radius:5px; display:none; } #dialog p { margin:0 0 12px; height:24px; line-height:24px; background:#CCCCCC; } #dialog p.close { text-align:right; padding-right:10px; } #dialog p.close a { color:#fff; text-decoration:none; } </style> <script type="text/javascript" src="jquery/jquery-1.10.2.min.js"></script> <script> $(document).ready(function(){ showBg(); }); </script> <script type="text/javascript"> //顯示灰色 jQuery 遮罩層 function showBg() { var bh = $("body").height(); var bw = $("body").width(); $("#fullbg").css({ height:bh, width:bw, display:"block" }); $("#dialog").show(); } //關(guān)閉灰色 jQuery 遮罩 function closeBg() { $("#fullbg,#dialog").hide(); } </script> </head> <body> <div id="main"><a href="javascript:showBg();" rel="external nofollow" >點(diǎn)擊這里查看效果</a> <div id="fullbg"></div> <div id="dialog"> <p class="close"><a href="#" rel="external nofollow" onclick="closeBg();">關(guān)閉</a></p> <div>正在加載,請(qǐng)稍后....</div> </div> </div> </body> </html>
運(yùn)行效果:
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery窗口操作技巧總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
- JS遮罩層效果 兼容ie firefox jQuery遮罩層
- JQuery 遮罩層實(shí)現(xiàn)(mask)實(shí)現(xiàn)代碼
- jQuery操作dom實(shí)現(xiàn)彈出頁(yè)面遮罩層(web端和移動(dòng)端阻止遮罩層的滑動(dòng))
- jQuery阻止移動(dòng)端遮罩層后頁(yè)面滾動(dòng)
- jQuery實(shí)現(xiàn)簡(jiǎn)單網(wǎng)頁(yè)遮罩層/彈出層效果兼容IE6、IE7
- Jquery實(shí)現(xiàn)遮罩層的簡(jiǎn)單實(shí)例(就是彈出DIV周?chē)蓟疑荒懿僮?
- jQuery+AJAX實(shí)現(xiàn)遮罩層登錄驗(yàn)證界面(附源碼)
- jQuery點(diǎn)擊按鈕彈出遮罩層且內(nèi)容居中特效
- Jquery實(shí)現(xiàn)遮罩層的方法
- jQuery實(shí)現(xiàn)彈出帶遮罩層的居中浮動(dòng)窗口效果
- JavaScript實(shí)現(xiàn)的彈出遮罩層特效經(jīng)典示例【基于jQuery】
相關(guān)文章
Jquery UI震動(dòng)效果實(shí)現(xiàn)原理及步驟
如果你想你的博客頁(yè)面某些部分引起讀者的注意,你可以使這些部分震動(dòng),如廣告等等,今天這篇文章將介紹怎樣使你的頁(yè)面中的元素震動(dòng)起來(lái),感興趣的你可不要錯(cuò)過(guò)了哦,或許對(duì)你學(xué)習(xí)jquery ui 有所幫助2013-02-02調(diào)用DOM對(duì)象的focus使文本框獲得焦點(diǎn)
要使對(duì)象獲得焦點(diǎn),應(yīng)該調(diào)用DOM對(duì)象的focus方法,下面有個(gè)不錯(cuò)的示例,大家可以參考下2014-02-02javascript 歷史記錄 經(jīng)常用于產(chǎn)品最近歷史瀏覽
在很多購(gòu)物網(wǎng)站,都有“產(chǎn)品的瀏覽歷史記錄”,這是個(gè)很貼心的功能。2009-05-05Jquery知識(shí)點(diǎn)一 Jquery的ready和Dom的onload的區(qū)別
onload是所有dom元素創(chuàng)建完畢,圖片、css等都加在完畢后才觸發(fā) ready則是dom元素創(chuàng)建完畢后就被觸發(fā)2011-01-01jQuery動(dòng)態(tài)產(chǎn)生select option下拉列表
這篇文章主要介紹了jQuery動(dòng)態(tài)產(chǎn)生select option下拉列表的實(shí)現(xiàn)方法,需要的朋友可以參考下2017-03-03