教程集 www.jiaochengji.com
教程集 >  jQuery  >  jquery 教程  >  正文 jquery 弹出层的小例子

jquery 弹出层的小例子

发布时间:2015-11-25   编辑:jiaochengji.com
分享一例jquery弹出层的代码,很简单,有需要的朋友可以参考学习下。

本节内容:
jquery 弹出提示效果

例子:
 

复制代码 代码示例:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery弹出层实例-www.jbxue.com</title>
<script type="text/javascript" src="/js/jquery-132min1.js"></script>
<script type="text/javascript">
$(function(){
$(".but").click(function(){
var str = "此处放置你的信息内容哦。";
$(".form").html(str);
$("#faqbg").css({display:"block",height:$(document).height()});
var yscroll =document.documentElement.scrollTop;
$("#faqdiv").css("top","100px");
$("#faqdiv").css("display","block");
document.documentElement.scrollTop=0;
});
$(".close").click(function(){
$("#faqbg").css("display","none");
$("#faqdiv").css("display","none");
});
})
</script>
<style type="text/css">
body,h2{margin:0 ; padding:0;}
#faqbg{background-color:#666666; 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;}
#faqdiv{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;}
#faqdiv h2{ height:25px; font-size:14px; background-color:#8FA4F5; position:relative; padding-left:10px; line-height:25px;}
#faqdiv h2 a{position:absolute; right:5px; font-size:12px; color:#FF0000}
#faqdiv .form{padding:10px;}
</style>
</head>
<body >
<div id="faqbg"></div>
<div id="faqdiv" style="display:none">
<h2>信息窗口<a href="#" class="close">关闭</a></h2>
<div class="form">
脚本学堂小编提醒,这里是信息内容部分。

</div>
</div>
<p align="center">
<input value="弹出" class="but" type="button" />
<input type="button" value="关闭" class="close" />
</p>
</body>
</html>

您可能感兴趣的文章:
点击弹出层外区域关闭弹出层jquery特效示例
jquery 弹出层的小例子
基于jquery的blockui插件显示弹出层
jquery实现点击弹出层效果的简单实例
jquery三个关闭弹出层的小示例
jquery 事件冒泡的介绍以及如何阻止事件冒泡
jquery实现弹出层完美居中效果
jquery删除提示框(弹出是否删除对话框)
jquery弹出关闭遮罩层实现代码
Jquery+CSS3实现一款简洁大气带滑动效果的弹出层

[关闭]
~ ~