js+css jQuery实现页面后退执行 & 遮罩弹框
JS部分
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function ($) {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '') {
//alert("希望该网站能提供你帮助!");
$('.onunload-box').css('display', 'inline');
$('.zhezhao').css('display', 'inline');
}
}
});
window.history.pushState('forward', null, './#forward');
}
});
$('.colsebtn').click(function(){
$('.onunload-box').css('display', 'none');
$('.zhezhao').css('display', 'none');
})
//点击遮罩部分,关闭弹框
$('.zhezhao').click(function(){
$('.onunload-box').css('display', 'none');
$('.zhezhao').css('display', 'none');
})
$('.bottom-box').click(function(){
$('.onunload-box').css('display', 'inline');
$('.zhezhao').css('display', 'inline');
});
</script>
CSS部分
.onunload-box{
width:400px;
height:268px;
border:1px #ad1d1d solid;
border-radius: 20px;
text-align: center;
position: fixed;
top:50%;
margin-top:-134px;
left:50%;
margin-left:-200px;
z-index:;
background-color: #fff;
padding:12px 24px 0;
color:#732205;
}
.btns{
height:100px;
width:100%;
border-top:1px #ad1d1d solid;
position: absolute;
bottom:-50px;
left:;
}
.colsebtn{
width:150px;
float:left;
line-height: 50px;
cursor:pointer;
}
.wxgghbtn{
width:256px;
height:50%;
line-height: 50px;
position:absolute;
right:;
background-color:#ad1d1d;
color:#fff;
border-bottom-right-radius: 20px;
}
.wxgghbtn>a{text-decoration: none;color:#fff;}
.p1{font-size:16px;margin-top:}
.p2{font-size:14px;color:#333;margin:0px;}
.p4{font-size:32px;font-weight: bold;margin:0px;}
.zhezhao
{
width:100%;
height:100%;
background-color:#000;
filter:alpha(opacity=60);
-moz-opacity:0.6;
opacity:0.6;
position:fixed;
left:0px;
top:0px;
display:none;
z-index:;
}
HTML部分
<div class='zhezhao'></div>
<div class='onunload-box' style='display:none'>
<p class='p1'>和田玉怎么鉴定的?你知道的和田玉是什么样的</p>
<p class='p2'>据统计,大部分的人都不知道和田玉石如何鉴定的。<br/><br/>鼎石专家教你如何鉴定和田玉小妙招</p>
<p class='p3'>添加鼎石和田玉为公众号好友,专家教您鉴赏和田玉</p>
<p class='p4'><script>document.write(stxlwx);</script></p>
<p class='p5'>先长按上方公众号直接复制</p>
<div class='btns'>
<div class='colsebtn'>谢谢,我不需要</div>
<div class='wxgghbtn' data-clipboard-target='.p4'>关注微信公众号,以后用得着</div>
</div>
</div>
js+css jQuery实现页面后退执行 & 遮罩弹框的更多相关文章
- 用JS或jQuery访问页面内的iframe,兼容IE/FF
用JS或jQuery访问页面内的iframe,兼容IE/FF js或者jQuery访问页面中的框架也就是iframe.注意:框架内的页面是不能跨域的! 假设有两个页面,在相同域下. index.htm ...
- 用JS或jQuery访问页面内的iframe
用JS或jQuery访问页面内的iframe,兼容IE/FF 注意:框架内的页面是不能跨域的!假设有两个页面,在相同域下.index.html 文件内含有一个iframe: <!DOCTYPE ...
- js 和 jquery 获取页面和滚动条的高度 视口高度文档高度
js 和 jquery 获取页面和滚动条的高度 //页面位置及窗口大小 function GetPageSize() { var scrW, scrH; if(window.innerHeight & ...
- js原生 + jQuery实现页面滚动字幕
js原生/jQuery实现页面滚动字幕效果 17:45:49 在新闻列表或者文章列表信息等页面中很容易要求实现字幕滚动的效果,以下为简单的实现页面中滚动字幕的效果 1.jQuery实现页面滚动字幕效果 ...
- js和jquery实现页面滚动监听
js和jquery实现页面滚动监听 一.总结 一句话总结:onscroll方法和监听页面元素的高度都可以实现滚动监听. 1.onscroll方法实现滚动监听的核心代码是什么? <body ons ...
- 利用layer实现MVC页面数据互交提示弹框
需求说明: 一个表单页面,点击提交之后,进入后台进行一系列数据交互,然后将交互信息返回至页面中,并以弹框形式展示 应用场景: 添加.修改.删除数据后,返回数据操作是否成功,以及一些其他信息 前期准备: ...
- Yii 引入js css jquery 执行操作
在布局中引用通用到js,或者css: <?php Yii::app()->clientScript->registerCoreScript('jquery');?> //注意 ...
- 常用[js,css,jquery,html]
目录: 一.javascript事件和属性 二.jquery事件和方法 三.js 四.css 五.html 六.js操作cookies 七.插件 javascript事件和属性 事件 onblur ...
- js或jquery实现页面打印(局部打印)
首先定义css样式: 复制代码代码如下: @media print { .noprint { display: none;color:green } } 对于不想打印的内容只用在标签中加上 cla ...
随机推荐
- 正则化,L1,L2
机器学习中在为了减小loss时可能会带来模型容量增加,即参数增加的情况,这会导致模型在训练集上表现良好,在测试集上效果不好,也就是出现了过拟合现象.为了减小这种现象带来的影响,采用正则化.正则化,在减 ...
- 雷林鹏分享:jQuery EasyUI 数据网格 - 启用行内编辑
jQuery EasyUI 数据网格 - 启用行内编辑 可编辑的功能是最近添加到数据网格(datagrid)的.它可以使用户添加一个新行到数据网格(datagrid).用户也可以更新一个或多个行. 本 ...
- Python使用ldap3认证
一.安装ldap3模块(python版本为python3以上,Django=1.11.8)pip install ldap3 二.相关代码 from ldap3 import Server, Conn ...
- Spring boot连接MongoDB集群
主要问题是:MongoDB集群分为复制集(replicaSet)与分片集(shardingSet),那么如何去连接这两种集群: 参考官方文档,我使用了最通用的方法:通过构造connection str ...
- Hadoop 2.7.4 HDFS+YRAN HA部署
实验环境 主机名称 IP地址 角色 统一安装目录 统一安装用户 sht-sgmhadoopnn-01 172.16.101.55 namenode,resourcemanager /usr/local ...
- .net core部署到Ubuntu
1.使用vs2017创建Asp.net Core Web应用程序,选择ubuntu中安装的.net core版本,这里选择2.1版本: 2.右键发布该项目,选择文件系统发布: 3.在ubuntu中安装 ...
- node有哪些坑?
const server = http.createServer((req, res) => {} const server = http.createServer((res, req) =&g ...
- 【阅读笔记】《C程序员 从校园到职场》第八章 算法和协议(Part 2)
原文链接: 让你提前认识软件开发(19):C语言中的协议及单元测试示例 CSDN博客 https://blog.csdn.net/zhouzhaoxiong1227/article/details/2 ...
- Windows和Linux下 Java开发ping工具类
package com.test.util; import java.io.BufferedReader; import java.io.IOException; import java.io.Inp ...
- 一个神奇的???whatever~~
一个神奇的类,用来封装消息数据,统一数据传递接口,从unity引擎源码拷贝而来. #include <iostream> #include <assert.h> #includ ...