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

首頁 > 編程 > JavaScript > 正文

javascript彈出窗口實現代碼

2019-11-20 11:17:45
字體:
來源:轉載
供稿:網友

很多網頁都實現了彈出窗口,使用方面,特別的人性化,本文就大家介紹javascript實現彈出窗口特效,具體代碼如下:

<!DOCTYPE html><html><head lang="en"><meta charset="UTF-8"><title>彈出窗口</title><script src="js/jquery-1.11.1.js"></script><style>*{ margin: 0; padding: 0;}div{ margin: 0 auto; /*border: 1px solid red;*/}.overBg{ width: 100%; height: 100%; background: gray; opacity: 0.5; filter: alpha(opacity=50); position: fixed; top:0; z-index: 300;}.tc-con{ width: 200px; height: 200px; padding: 30px; background: blanchedalmond; position: fixed; top: 0; z-index: 1000;}</style><script> $(function(){  $('.tc').hide();  $('.btn').click(function(){   $('.tc').show();  })  $('.tc').click(function(){   $(this).hide();  }) })</script></head><body><div class="btn">點擊出現</div><div class="tc"> <div class="overBg"></div> <div class="tc-con" id="tc-con">22</div> <script>  var a=document.getElementById('tc-con');  a.style.left=(document.body.clientWidth/2- a.clientWidth/2)+'px';  a.style.top=(document.documentElement.clientHeight/2- a.clientHeight/2)+'px'; </script></div><div style="height:2000px">22</div></body></html><!DOCTYPE html><html><head lang="en"><meta charset="UTF-8"><title>彈出窗口</title><script src="js/jquery-1.11.1.js"></script><style>*{ margin: 0; padding: 0;}div{ margin: 0 auto; /*border: 1px solid red;*/}.overBg{ width: 100%; height: 100%; background: gray; opacity: 0.5; filter: alpha(opacity=50); position: fixed; top:0; z-index: 300;}.tc-con{ width: 200px; height: 200px; padding: 30px; background: blanchedalmond; position: fixed; top: 0; z-index: 1000;}</style><script> $(function(){  $('.tc').hide();  $('.btn').click(function(){   $('.tc').show();  })  $('.tc').click(function(){   $(this).hide();  }) })</script></head><body><div class="btn">點擊出現</div><div class="tc"> <div class="overBg"></div> <div class="tc-con" id="tc-con">22</div> <script>  var a=document.getElementById('tc-con');  a.style.left=(document.body.clientWidth/2- a.clientWidth/2)+'px';  a.style.top=(document.documentElement.clientHeight/2- a.clientHeight/2)+'px'; </script></div><div style="height:2000px">22</div></body></html>

效果圖:

以上就是為大家分享的javascript彈出窗口實現代碼,希望對大家的學習有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 怀集县| 黄石市| 黑龙江省| 龙陵县| 江华| 来安县| 朔州市| 千阳县| 甘南县| 红河县| 于田县| 铁岭市| 永定县| 南丹县| 汨罗市| 昌吉市| 兰坪| 绥江县| 晋城| 鄂温| 松滋市| 和静县| 海林市| 尚义县| 秭归县| 白山市| 涡阳县| 麟游县| 藁城市| 淮阳县| 峨眉山市| 方城县| 封丘县| 潍坊市| 谷城县| 那曲县| 昔阳县| 建平县| 手机| 建平县| 柏乡县|