jquery實(shí)現(xiàn)彈出層效果實(shí)例
更新時(shí)間:2015年05月19日 15:30:16 作者:張林春
這篇文章主要介紹了jquery實(shí)現(xiàn)彈出層效果的方法,實(shí)例分析了jQuery實(shí)現(xiàn)彈出層的技巧,涉及jQuery操作頁(yè)面元素與樣式的技巧,需要的朋友可以參考下
本文實(shí)例講述了jquery實(shí)現(xiàn)彈出層效果的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
<head runat="server">
<title>jQuery彈出層</title>
<script type="text/javascript" src="js/jquery-1.3.2-min.js"></script>
<script type="text/javascript">
$(function() {
$("#btnShow").click(function() {
// var str = "我是彈出對(duì)話框";
// $(".form").html(str);
$("#BgDiv").css({ display: "block", height: $(document).height()});
var yscroll = document.documentElement.scrollTop;
$("#DialogDiv").css("top", "100px");
$("#DialogDiv").css("display", "block");
document.documentElement.scrollTop = 0;
});
$("#btnClose").click(function() {
$("#BgDiv").css("display", "none");
$("#DialogDiv").css("display", "none");
});
});
</script>
<style type="text/css">
body, h2
{
margin: 0;
padding: 0;
}
#BgDiv
{
background-color: #e3e3e3;
position: absolute;
z-index: 99;
left: 0;
top: 0;
display: none;
width: 100%;
height: 1000px;
opacity: 0.5;
filter: alpha(opacity=50);
-moz-opacity: 0.5;
}
#DialogDiv
{
position: absolute;
width: 400px;
left: 50%;
top: 50%;
margin-left: -200px;
height: auto;
z-index: 100;
background-color: #fff;
border: 1px #8FA4F5 solid;
padding: 1px;
}
#DialogDiv h2
{
height: 25px;
font-size: 14px;
background-color: #8FA4F5;
position: relative;
padding-left: 10px;
line-height: 25px;
}
#DialogDiv h2 a
{
position: absolute;
right: 5px;
font-size: 12px;
color: #000000;
}
#DialogDiv .form
{
padding: 10px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="BgDiv"></div>
<div id="DialogDiv" style="display: none">
<h2>
彈出層<a href="#" id="btnClose">關(guān)閉</a></h2>
<div class="form">
我是彈出對(duì)話框!!<br />
我是彈出對(duì)話框!!<br />
我是彈出對(duì)話框!!<br />
我是彈出對(duì)話框!!<br />
我是彈出對(duì)話框!!<br />
我是彈出對(duì)話框!!<br />
我是彈出對(duì)話框!!<br />
</div>
</div>
<p>
</p>
<p align="center">
<input value="彈出" class="but" type="button" id="btnShow" />
</p>
</form>
</body>
</html>
希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:
- div彈出層的ajax登錄(Jquery版+c#)
- jquery實(shí)現(xiàn)簡(jiǎn)單實(shí)用的彈出層效果代碼
- jquery實(shí)現(xiàn)仿新浪微博帶動(dòng)畫效果彈出層代碼(可關(guān)閉、可拖動(dòng))
- jquery實(shí)現(xiàn)可自動(dòng)判斷位置的彈出層效果代碼
- jquery簡(jiǎn)單的彈出層浮動(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簡(jiǎn)單彈出層效果代碼
相關(guān)文章
jQueryUI Datepicker組件設(shè)置日期高亮
這篇文章主要介紹了jQueryUI Datepicker組件設(shè)置日期高亮的相關(guān)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-10-10
jQuery自定義圖片縮放拖拽插件imageQ實(shí)現(xiàn)方法(附demo源碼下載)
這篇文章主要介紹了jQuery自定義圖片縮放拖拽插件imageQ實(shí)現(xiàn)方法,涉及jQuery擴(kuò)展操作及頁(yè)面元素操作技巧,并附帶了完整的demo源碼供讀者下載參考,需要的朋友可以參考下2016-05-05
jquery ajax實(shí)現(xiàn)下拉框三級(jí)無(wú)刷新聯(lián)動(dòng),且保存保持選中值狀態(tài)
jquery ajax實(shí)現(xiàn)下拉框三級(jí)無(wú)刷新聯(lián)動(dòng),且保存保持選中值狀態(tài)。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2013-10-10
jquery實(shí)現(xiàn)靜態(tài)搜索功能(可輸入搜索文字)
本文主要介紹了jquery實(shí)現(xiàn)靜態(tài)搜索功能的示例代碼,可通過(guò)輸入搜索文字進(jìn)行篩選信息。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧2017-03-03

