jquery 弹出框
来源:互联网 发布:ar涂色 源码 编辑:程序博客网 时间:2024/05/17 22:44
jquery弹出框,简洁版本
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>test.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><script src="js/jquery-1.6.js"></script><script src="js/jquery_alert.js"></script> </head> <body> This is my HTML page. <br> <div class="showbtn">弹出</div> <lable class="showbtn">弹出</lable> <div class="box" style="display:none"> <h2>jQuery 学习交流<a href="#" class="close">关闭</a></h2> <div class="list"> <ul> <li>我是稀饭</li> <li>我是稀饭</li> <li>我是稀饭</li> </ul> </div></div> </body></html>
jquery_alert.js
//如何使用弹出层的js //1.必须含有jquery//2.在body下面有个class 为box的div,为弹出层//原理见http://www.jquery001.com/jquery-mask-layer.html$(function () {initalertcss(); $(".showbtn").click(function () { $("#bg").css({ display: "block", height: $(document).height() }); var $box = $('.box'); $box.css({ //设置弹出层距离左边的位置 left: ($("body").width() - $box.width()) / 2 - 20 + "px", //设置弹出层距离上面的位置 top: ($(window).height() - $box.height()) / 2 + $(window).scrollTop() + "px", display: "block" }); }); //点击关闭按钮的时候,遮罩层关闭 $(".close").click(function () { $("#bg,.box").css("display", "none"); });});function initalertcss(){//这里http://www.bejson.com/jshtml_format/通过它来互转//cssvar tmp='<style>ul{list-style: none outside none;}.box h2{margin: 0;padding: 0;}.box{position:absolute;width:600px;left:50%;height:auto;z-index:100;background-color:#fff;border:1px #ddd solid;padding:1px}.box h2{height:25px;font-size:16px;background-color:#aaa;position:relative;padding-left:10px;line-height:25px;color:#fff}.box h2 a{position:absolute;right:5px;font-size:14px;color:#fff}.box .list{padding:10px}.box .list li{height:24px;line-height:24px}.box .list li span{margin:0 5px 0 0;font-family:\"宋体\";font-size:12px;font-weight:400;color:#ddd}.showbtn{font:bold 24px \'微软雅黑\'}#bg{background-color:#666;position:absolute;z-index:99;left:0;top:0;display:none;width:100%;height:100%;opacity:0.5;filter:alpha(opacity=50);-moz-opacity:0.5}</style>';//bgtmp=tmp+'<div id=bg></div>'$("body").append(tmp);}
0 0
- jquery弹出框
- JQuery实现弹出框
- JQuery弹出框总结
- JQuery弹出框总结
- jQuery 弹出框插件
- jquery弹出框
- JQuery弹出框总结
- jquery之弹出框
- jquery pop弹出框
- JQuery 做弹出框
- jquery 右下角弹出框
- JQuery 悬浮弹出框
- jquery弹出提示框
- JQUERY弹出框
- jquery 弹出框
- js/jQuery弹出框
- jquery 弹出框
- 弹出框html5 jquery
- ios框架介绍--C字头
- android RecyclerView 使用完全解析 替代ListView(一)
- css3网站
- VS2015 build kmdf for Window 8.1
- OpenCV 的内存泄露问题(静态内存泄露)
- jquery 弹出框
- java 中简单读取Properties配置文件
- 跨站脚本攻击实现原理
- 雅虎开源的Kafka集群管理器(Kafka Manager)
- @AspectJ使用示例
- 跟上节奏 大数据时代十大必备IT技能 ——韩钊
- IOS 随机字符串
- 万维网www的历史、发展、特点和相关协议详解
- C#散乱资料