国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery實現簡單實用的彈出層效果代碼

2019-11-20 11:27:59
字體:
來源:轉載
供稿:網友

本文實例講述了jquery實現簡單實用的彈出層效果。分享給大家供大家參考。具體如下:

目前來說,我還是喜歡這個自己改造的彈出層,在項目中用的也是這個。引入了新版的jquery插件,方框及文字都可以自己定義,非常方便,希望大家也喜歡這款彈出層,JavaScript在本例中也充分發揮了作用,對學習JS也是不錯的參考。

運行效果截圖如下:

在線演示地址如下:

http://demo.VeVB.COm/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());};//關閉彈出層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="點擊彈出層" onclick="ShowDiv('MyDiv','fade')" /><!--彈出層時背景層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')">關閉</span>  </div>  目前來說,我還是喜歡這個自己改造的彈出層。自己在項目中也用的是這個。 </div></body></html>

希望本文所述對大家的jquery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 麦盖提县| 全州县| 平昌县| 镇原县| 牟定县| 蕲春县| 石柱| 洛扎县| 石城县| 正镶白旗| 甘肃省| 富平县| 扶风县| 无锡市| 博湖县| 常山县| 武隆县| 都安| 岱山县| 全椒县| 扎兰屯市| 定边县| 虎林市| 巴彦县| 关岭| 乌拉特前旗| 玉溪市| 临朐县| 呈贡县| 二手房| 观塘区| 东平县| 且末县| 都兰县| 金川县| 榆中县| 延寿县| 马山县| 天门市| 河北省| 桃江县|