最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

javascript彈出窗口實(shí)現(xiàn)代碼

 更新時(shí)間:2015年11月12日 09:02:28   作者:浮世微涼  
這篇文章主要介紹了javascript彈出窗口實(shí)現(xiàn)代碼,非常人性化的設(shè)計(jì),點(diǎn)擊頁面可以彈出窗口,感興趣的小伙伴們可以參考一下

很多網(wǎng)頁都實(shí)現(xiàn)了彈出窗口,使用方面,特別的人性化,本文就大家介紹javascript實(shí)現(xiàn)彈出窗口特效,具體代碼如下:

<!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">點(diǎn)擊出現(xiàn)</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">點(diǎn)擊出現(xiàn)</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彈出窗口實(shí)現(xiàn)代碼,希望對(duì)大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評(píng)論

乌海市| 霍山县| 杭锦后旗| 兴业县| 康保县| 涿鹿县| 泊头市| 合作市| 时尚| 都兰县| 石家庄市| 北安市| 大竹县| 新闻| 招远市| 嘉兴市| 延庆县| 抚松县| 贵港市| 沽源县| 昌乐县| 龙海市| 竹山县| 广丰县| 阿坝| 平远县| 延津县| 伊宁市| 宿州市| 高密市| 兴安县| 怀来县| 砀山县| 大石桥市| 穆棱市| 遂昌县| 本溪市| 桐乡市| 怀宁县| 许昌市| 铜陵市|