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实现页面后退执行 & 遮罩弹框的更多相关文章

  1. 用JS或jQuery访问页面内的iframe,兼容IE/FF

    用JS或jQuery访问页面内的iframe,兼容IE/FF js或者jQuery访问页面中的框架也就是iframe.注意:框架内的页面是不能跨域的! 假设有两个页面,在相同域下. index.htm ...

  2. 用JS或jQuery访问页面内的iframe

    用JS或jQuery访问页面内的iframe,兼容IE/FF 注意:框架内的页面是不能跨域的!假设有两个页面,在相同域下.index.html 文件内含有一个iframe: <!DOCTYPE ...

  3. js 和 jquery 获取页面和滚动条的高度 视口高度文档高度

    js 和 jquery 获取页面和滚动条的高度 //页面位置及窗口大小 function GetPageSize() { var scrW, scrH; if(window.innerHeight & ...

  4. js原生 + jQuery实现页面滚动字幕

    js原生/jQuery实现页面滚动字幕效果 17:45:49 在新闻列表或者文章列表信息等页面中很容易要求实现字幕滚动的效果,以下为简单的实现页面中滚动字幕的效果 1.jQuery实现页面滚动字幕效果 ...

  5. js和jquery实现页面滚动监听

    js和jquery实现页面滚动监听 一.总结 一句话总结:onscroll方法和监听页面元素的高度都可以实现滚动监听. 1.onscroll方法实现滚动监听的核心代码是什么? <body ons ...

  6. 利用layer实现MVC页面数据互交提示弹框

    需求说明: 一个表单页面,点击提交之后,进入后台进行一系列数据交互,然后将交互信息返回至页面中,并以弹框形式展示 应用场景: 添加.修改.删除数据后,返回数据操作是否成功,以及一些其他信息 前期准备: ...

  7. Yii 引入js css jquery 执行操作

    在布局中引用通用到js,或者css: <?php Yii::app()->clientScript->registerCoreScript('jquery');?>  //注意 ...

  8. 常用[js,css,jquery,html]

    目录: 一.javascript事件和属性 二.jquery事件和方法 三.js 四.css 五.html 六.js操作cookies 七.插件 javascript事件和属性 事件 onblur   ...

  9. js或jquery实现页面打印(局部打印)

    首先定义css样式:  复制代码代码如下: @media print { .noprint { display: none;color:green } }  对于不想打印的内容只用在标签中加上 cla ...

随机推荐

  1. nginx windows版 下载和启动

    nginx Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.因它的稳定性.丰富的功能集.示例配置文件和低系统资源的消耗而闻名.在连 ...

  2. 重写console.log的一些理解

    关于重写console.log的方式通常都是这样的: console.log = (function(oriLogFunc){ return function(str) { oriLogFunc.ca ...

  3. js中defer实现等文档加载完在执行脚本

    我们可以使用defer来实现类似window.onload的功能: <script src="../CGI-bin/delscript.js" defer></s ...

  4. 在虚拟环境下运行 Confluence 6

    这个页面针对运行在虚拟硬件环境下的 Confluence 提供一些信息. 概要 在虚拟环境(virtual machine (VM))下运行 Confluence 需要一些特定的技能来进行设定和进行管 ...

  5. .net获取程序根目录

    获取程序的根目录: var path = HttpRuntime.AppDomainAppPath;

  6. Annotations

    一.介绍 注解,可以将注解看成一种特殊的接口.是一种特殊种类的元数据,它能够关联Java语言中不同元素和结构.有意思的是,在Java生态系统中大多数使用样板XML描述符的地方,注解在消除这些XML描述 ...

  7. Win10系列:C#应用控件基础15

    ProgressRing控件 上一小节讲解了ProgressBar控件的使用方法,ProgressRing控件和ProgressBar控件都是用来显示应用程序当前任务的运行进度信息,区别在于Progr ...

  8. 【阅读笔记】《C程序员 从校园到职场》第六章 常用文件操作函数 (Part 1)

    参考链接:https://blog.csdn.net/zhouzhaoxiong1227/article/details/24926023 让你提前认识软件开发(18):C语言中常用的文件操作函数总结 ...

  9. angualr Material Icons

    首先需要项目引入 angualr meterial icons的资源库 图标资源链接 https://klarsys.github.io/angular-material-icons/ <md- ...

  10. TCP/IP 数据包报文格式(IP包、TCP报头、UDP报头)(转)

    reference:http://blog.51cto.com/lyhbwwk/2162568                    https://blog.csdn.net/wangzhen209 ...