jquery實(shí)現(xiàn)簡單實(shí)用的彈出層效果代碼
本文實(shí)例講述了jquery實(shí)現(xiàn)簡單實(shí)用的彈出層效果。分享給大家供大家參考。具體如下:
目前來說,我還是喜歡這個(gè)自己改造的彈出層,在項(xiàng)目中用的也是這個(gè)。引入了新版的jquery插件,方框及文字都可以自己定義,非常方便,希望大家也喜歡這款彈出層,JavaScript在本例中也充分發(fā)揮了作用,對學(xué)習(xí)JS也是不錯(cuò)的參考。
運(yùn)行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-simple-alert-style-demo/
具體代碼如下:
<!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>彈出層</title> <script src="jquery-1.6.2.min.js" type="text/javascript"></script> <style> .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80); } .white_content { display: none; position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; border: 16px solid lightblue; background-color: white; z-index:1002; overflow: auto; } .white_content_small { display: none; position: absolute; top: 20%; left: 30%; width: 40%; height: 50%; border: 16px solid lightblue; background-color: white; z-index:1002; overflow: auto; } </style> <script type="text/javascript"> //彈出隱藏層 function ShowDiv(show_div,bg_div){ document.getElementById(show_div).style.display='block'; document.getElementById(bg_div).style.display='block' ; var bgdiv = document.getElementById(bg_div); bgdiv.style.width = document.body.scrollWidth; // bgdiv.style.height = $(document).height(); $("#"+bg_div).height($(document).height()); }; //關(guān)閉彈出層 function CloseDiv(show_div,bg_div) { document.getElementById(show_div).style.display='none'; document.getElementById(bg_div).style.display='none'; }; </script> </head> <body> <input id="Button1" type="button" value="點(diǎn)擊彈出層" onclick="ShowDiv('MyDiv','fade')" /> <!--彈出層時(shí)背景層DIV--> <div id="fade" class="black_overlay"> </div> <div id="MyDiv" class="white_content"> <div style="text-align: right; cursor: default; height: 40px;"> <span style="font-size: 16px;" onclick="CloseDiv('MyDiv','fade')">關(guān)閉</span> </div> 目前來說,我還是喜歡這個(gè)自己改造的彈出層。自己在項(xiàng)目中也用的是這個(gè)。 </div> </body> </html>
希望本文所述對大家的jquery程序設(shè)計(jì)有所幫助。
- div彈出層的ajax登錄(Jquery版+c#)
- jquery實(shí)現(xiàn)仿新浪微博帶動(dòng)畫效果彈出層代碼(可關(guān)閉、可拖動(dòng))
- jquery實(shí)現(xiàn)可自動(dòng)判斷位置的彈出層效果代碼
- jquery實(shí)現(xiàn)彈出層效果實(shí)例
- jquery簡單的彈出層浮動(dòng)層代碼
- jQuery彈出層插件Lightbox_me使用指南
- jQuery+html5實(shí)現(xiàn)div彈出層并遮罩背景
- jQuery插件zoom實(shí)現(xiàn)圖片全屏放大彈出層特效
- jQuery點(diǎn)縮略圖彈出層顯示大圖片
- Jquery彈出層插件ThickBox的使用方法
- jQuery實(shí)現(xiàn)的AJAX簡單彈出層效果代碼
相關(guān)文章
Jquery創(chuàng)建層顯示標(biāo)題和內(nèi)容且隨鼠標(biāo)移動(dòng)而移動(dòng)
本文為大家介紹下使用Jquery創(chuàng)建一個(gè)層顯示標(biāo)題的內(nèi)容且隨鼠標(biāo)移動(dòng),具體的實(shí)現(xiàn)如下2014-01-01JQuery實(shí)現(xiàn)DIV其他動(dòng)畫效果的簡單實(shí)例
下面小編就為大家?guī)硪黄狫Query實(shí)現(xiàn)DIV其他動(dòng)畫效果的簡單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-09-09jquery實(shí)現(xiàn)橫向圖片輪播特效代碼分享
這篇文章主要介紹了jquery實(shí)現(xiàn)橫向圖片輪播特效代碼,效果很精致,實(shí)現(xiàn)方法很簡單,特推薦給大家,希望大家可以喜歡。2015-11-11jquery實(shí)現(xiàn)全選、全不選以及單選功能
本文主要介紹了jquery實(shí)現(xiàn)全選、全不選以及單選功能的實(shí)現(xiàn)代碼。具有很好的參考價(jià)值。下面跟著小編一起來看下吧2017-03-03JQuery+JS實(shí)現(xiàn)仿百度搜索結(jié)果中關(guān)鍵字變色效果
JQuery+JS實(shí)現(xiàn)仿百度搜索結(jié)果中關(guān)鍵字變色效果代碼,需要的朋友可以參考下。2011-08-08jQuery中each循環(huán)的跳出和結(jié)束實(shí)例
下面小編就為大家?guī)硪黄猨Query中each循環(huán)的跳出和結(jié)束實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-08-08