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 ...
随机推荐
- P1108 低价购买
传送门 思路: 对于第一问很容易看出是求最长下降子序列,N2 的暴力就可解决.而第二问是求最优方案数(且不重复),需要判重.可以在求解最长下降子序列的基础上增开一个数组 g ,g[ i ] 表示以 i ...
- 与vnpy相关的有用博客网址
https://blog.csdn.net/Trader_Python/article/list/1
- HashMap 和 HashTable差别
代码版本 JDK每一版本都在改进.本文讨论的HashMap和HashTable基于JDK 1.7.0_67.源码见这里 1. 时间 HashTable产生于JDK 1.1,而HashMap产生于JDK ...
- faker 模块
faker是python的一个第三方模块,是一个github上的开源项目. 主要用来创建一些测试用的随机数据 文档:https://faker.readthedocs.io/en/master/ind ...
- 238. Product of Array Except Self除自身以外数组的乘积
网址:https://leetcode.com/problems/product-of-array-except-self/ 参考:https://leetcode.com/problems/prod ...
- jvm回收器回收过程一:CMS和 G1的初认知(持续更新中)
CMS:介绍: 1.CMS(Concurrent Mark-Sweep)是以牺牲吞吐量为代价来获得最短回收停顿时间的垃圾回收器.对于要求服务器响应速度的应用上,这种垃圾回收器非常适合. 在启动JVM参 ...
- sass compass config.rb
require 'compass/import-once/activate' # Require any additional compass plugins here. # Set this to ...
- Vue(五) 购物车案例
这一篇把之前所学的内容做一个总结,实现一个购物车样例,可以增加或者减少购买数量,可移除商品,并且购物车总价随着你的操作实时变化. 实现效果如图: 代码: <!DOCTYPE html> & ...
- Problem B: 平面上的点和线——Point类、Line类 (II)
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定,两点确定一条线段.现在我们封装一个“Point类”和“Line类”来实现平面上的点的操作. 根据“append ...
- ::WritePrivateProfileString()的用法,以及GetPrivateProfileString的用法注意事项
WritePrivateProfileString(_T("Section1"),_T("Field1"),Field,savePath); 函数说明,这是在写 ...