jQuery+html5實現div彈出層並遮罩背景,jqueryhtml5

來源:互聯網
上載者:User

jQuery+html5實現div彈出層並遮罩背景,jqueryhtml5

漸入彈窗,背景變色不可點擊。查看效果:http://runjs.cn/detail/t08gmoij

<!doctype html><html><head><meta charset="utf-8"><title>popup</title><script type="text/javascript" src="jquery-2.1.3.min.js"></script></head><style type="text/css">#popup{  position: absolute;display:none; z-index:3000; background-color:#FFF; left: 601px; top: 217px; height: 150px; width: 217px;line-height:94px;text-align:center;  border: 1px solid #03F;}#embedding{  position: absolute; background-color: #36F; top: 94px;height:56px; width:217px;line-height:56px;text-align:center;}a{  text-decoration:none;  font-family:"微軟雅黑";  font-size:18px;  color:#FFF;}</style><script type="text/javascript">$(function(){  var url = null;  $(document).on('click','button',function(){    var text = $(this).text();    switch(text){      case 'OSChina':url = 'http://www.oschina.net/';break;      case 'baidu':url = 'http://www.baidu.com/';break;      case 'CSDN':url = 'http://bbs.csdn.net/home';break;      }    $('#text').text('是否確定前往 '+text+' ?');    $('#loadingDiv').css('display','block');      $('#popup').slideDown();  });   $(document).on('click','a',function(){    if($(this).text()=='確定'){      location.href=url;    }else{      $('#loadingDiv').css('display','none');       $('#popup').slideUp();    }  });});</script><body><div id="loadingDiv" style="position:fixed;display:none;z-index:2000;top:0px;left:0px;width:100%;height:100%;background-color:rgba(255,255,0,0.5)"></div><div id="popup">  <span id="text"></span>  <div id="embedding">    <a href="javascript:void(0)">確定</a>       <a href="javascript:void(0)">取消</a>  </div></div><button style="position: absolute; left: 233px; top: 260px;" >OSChina</button><button style="position: absolute; left: 233px; top: 320px;" >baidu</button><button style="position: absolute; left: 233px; top: 380px;" >CSDN</button></body></html>

以上所述就是本文的全部內容了,希望大家能夠喜歡。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.