<!DOCTYPE>
<html>
<head>
<title>点击文字弹出一个DIV层窗口代码</title>
<style>
.black_overlay{
display: none; /* 此元素不会被显示*/
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001; /* z-index 属性设置元素的堆叠顺序。拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面。*/
-moz-opacity: 0.8;
opacity:.80; /* opacity 属性设置元素的不透明级别。*/
filter: alpha(opacity=88);
/* 所有浏览器都支持 opacity 属性。 注释:IE8 以及更早的版本支持替代的 filter 属性。例如:filter:Alpha(opacity=50)。*/
}
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 55%;
height: 55%;
padding: 20px;
border: 10px solid orange;
background-color: white;
z-index:1002;
overflow: auto;
}
</style>
</head>
<body>
<p>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">
<img width="100%" src="/图片地址">
</a>
</p>
<div id="light" class="white_content">
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">关闭窗口</a>
</br>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
<script>
$(document).ready(function(){
var clipboard = new Clipboard('#copy_btn');
clipboard.on('success', function(e) {
alert("微信号复制成功",1500);
window.location.href='weixin://';
e.clearSelection();
console.log(e.clearSelection);
});
});
</script>
<script>
arr_wx =new Array("b861681","px999px","yjc20088888888");
var wx_index = Math.floor((Math.random() * arr_wx.length));
var stxlwx = arr_wx[wx_index];
var img = "<?php echo $pctem['pathurl'] ?>"+arr_wx[wx_index]+".jpg"
</script>
<center> <h1>点击添加客服微信 </h1></center>
<center> <h1> 客服微信号:<span id="target"><script>document.write(stxlwx)</script> </span></h1>
<button class="btn" data-clipboard-action="copy" data-clipboard-target="#target" id="copy_btn" style="
width: 300px !important;
height: 50px !important;
background: #ec0b0b;
display: table;
margin: 20px auto 30px;
line-height: 46px !important;
color: #fff;
font-size: 16px;
text-align: center;
border-radius: 5px;
text-decoration: none;
transition: all .3s;
">
点击复制
</button> <center>
</div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
作者:海,如若转载,请注明出处:《实用的弹窗代码+微信点击辅助+微信轮播》