久久草情侣vs国产&久久精品国产av一级二级三级&日韩免费黄色视频&精品一区二区三区av天堂&玩弄少妇高潮a片水蜜桃网站&女教师韩国

歡迎來到億搜云建站平臺,全網營銷云系統加盟中心!

海量企業網站模板 · 任您選擇

美出特色,精出品質,一切為了企業更好的營銷

隱藏側欄
Beta
轉載

js精美的彈出層效果代碼

       彈出層     2016-02-16     eycms     89     0    

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>cwx - javascript</title>

<style type="text/css">

*{ margin:0px; padding:0px;}

body{ font-size:12px; font:Arial, Helvetica, sans-serif; margin:25PX 0PX; background:#eee;}

.botton{ color:#F00; cursor:pointer;}

.mybody{width:600px; margin:0 auto; height:1500px; border:1px solid #ccc; padding:20px 25px; background:#fff}

#cwxBg{ position:absolute; display:none; background:#000; width:100%; height:100%; left:0px; top:0px; z-index:1000;}

#cwxWd{ position:absolute; display:none; border:10px solid #CCC; padding:10px;background:#FFF; z-index:1500;}

#cwxCn{ background:#FFF; display:block;}

.imgd{ width:400px; height:300px;}

</style>

</head>


<body>

<!--彈出窗-->

<div class="mybody">

<div class="botton" id="testClick">點擊測試</div>

        asdasdasdasdasdasdasd<br/>asdasdasdasdasd

        <div class="botton" id="testClick1">點擊測試</div>

    </div>

    <script type="text/javascript">

    C$('testClick').onclick = function(){

var neirong = '<div><img  src="http://filesimg.1XX.cn.net/2013/05/06/20130506123246475.png" class="imgd" /></div>';

cwxbox.box.show(neirong);

}

C$('testClick1').onclick = function(){

var neirong = '123456789132456789';

cwxbox.box.show(neirong,3);

}


function C$(id){return document.getElementById(id);}


//定義窗體對象

var cwxbox = {};


cwxbox.box = function(){

var bg,wd,cn,ow,oh,o = true,time = null;

return {

show:function(c,t,w,h){

if(o){

bg = document.createElement('div'); bg.id = 'cwxBg';

wd = document.createElement('div'); wd.id = 'cwxWd';

cn = document.createElement('div'); cn.id = 'cwxCn';

document.body.appendChild(bg);

document.body.appendChild(wd);

wd.appendChild(cn);

bg.onclick = cwxbox.box.hide;

window.onresize = this.init;

window.onscroll = this.scrolls;

o = false;

}

if(w && h){

var inhtml = '<iframe src="'+ c +'" width="'+ w +'" height="'+ h +'" frameborder="0"></iframe>';

}else{

var inhtml = c;

}

cn.innerHTML = inhtml;

oh = this.getCss(wd,'offsetHeight');

ow = this.getCss(wd,'offsetWidth');

this.init();

this.alpha(bg,50,1);

this.drag(wd);

if(t){

time = setTimeout(function(){cwxbox.box.hide()},t*1000);

}

},

hide:function(){

cwxbox.box.alpha(wd,0,-1);

clearTimeout(time);

},

init:function(){

bg.style.height = cwxbox.page.total(1)+'px';

bg.style.width = '';

bg.style.width = cwxbox.page.total(0)+'px';

var h = (cwxbox.page.height() - oh) /2;

wd.style.top=(h+cwxbox.page.top())+'px';

wd.style.left=(cwxbox.page.width() - ow)/2+'px';

},

scrolls:function(){

var h = (cwxbox.page.height() - oh) /2;

wd.style.top=(h+cwxbox.page.top())+'px';

},

alpha:function(e,a,d){

clearInterval(e.ai);

if(d==1){

e.style.opacity=0; 

e.style.filter='alpha(opacity=0)';

e.style.display = 'block';

}

e.ai = setInterval(function(){cwxbox.box.ta(e,a,d)},40);

},

ta:function(e,a,d){

var anum = Math.round(e.style.opacity*100);

if(anum == a){

clearInterval(e.ai);

if(d == -1){

e.style.display = 'none';

if(e == wd){

this.alpha(bg,0,-1);

}

}else{

if(e == bg){

this.alpha(wd,100,1);

}

}

}else{

var n = Math.ceil((anum+((a-anum)*.5)));

n = n == 1 ? 0 : n;

e.style.opacity=n/100;

e.style.filter='alpha(opacity='+n+')';

}

},

getCss:function(e,n){

var e_style = e.currentStyle ? e.currentStyle : window.getComputedStyle(e,null);

if(e_style.display === 'none'){

var clonDom = e.cloneNode(true);

clonDom.style.cssText = 'position:absolute; display:block; top:-3000px;';

document.body.appendChild(clonDom);

var wh = clonDom[n];

clonDom.parentNode.removeChild(clonDom);

return wh;

}

return e[n];

},

drag:function(e){

var startX,startY,mouse;

mouse = {

mouseup:function(){

if(e.releaseCapture)

{

e.onmousemove=null;

e.onmouseup=null;

e.releaseCapture();

}else{

document.removeEventListener("mousemove",mouse.mousemove,true);

document.removeEventListener("mouseup",mouse.mouseup,true);

}

},

mousemove:function(ev){

var oEvent = ev||event;

e.style.left = oEvent.clientX - startX + "px";  

e.style.top = oEvent.clientY - startY + "px"; 

}

}

e.onmousedown = function(ev){

var oEvent = ev||event;

startX = oEvent.clientX - this.offsetLeft;  

startY = oEvent.clientY - this.offsetTop;

if(e.setCapture)

{

e.onmousemove= mouse.mousemove;

e.onmouseup= mouse.mouseup;

e.setCapture();

}else{

document.addEventListener("mousemove",mouse.mousemove,true);

document.addEventListener("mouseup",mouse.mouseup,true);

}


}

}

}()


cwxbox.page = function(){

return{

top:function(){return document.documentElement.scrollTop||document.body.scrollTop},

width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},

height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},

total:function(d){

var b=document.body, e=document.documentElement;

return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):

Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))

}

}

}()

    </script>

</body>

</html></td>

 </tr>

</table>


--結束END--

本文鏈接: http://www.kblvmr5.cn/resources/popup/1146.html (轉載時請注明來源鏈接)

 
本文標簽: 全部

下班PC閱讀不方便?

手機也可以隨時學習開發

微信關注公眾號“億搜云”
"億搜云平臺前端開發教學"
每日干貨技術分享
 

×

成為 億搜云平臺 代理商!

關注

微信
關注

微信掃一掃
獲取最新優惠信息

億搜云平臺公眾號

客服

聯系
客服

很高興為您服務
尊敬的用戶,歡迎您咨詢,我們為新用戶準備了優惠好禮。 咨詢客服

聯系客服:

在線QQ: 40819446

客服電話: 15250286283

售前咨詢 售后服務
在線交談 智能小云

工作時間:

周一至周五: 09:00 - 17:00

WAP

手機
訪問

移動端訪問
手機上也能選模板

億搜云平臺手機端