日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > web前端 > htmlcss > 奉獻一個實用的JS動畫彈出層效果

奉獻一個實用的JS動畫彈出層效果

來源:程序員人生   發布時間:2015-04-22 08:07:09 閱讀次數:2697次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>動畫彈出層</title>
<style>
.list{
position:relative;;
background:#eee;
border:1px #ccc solid;
margin:10px;
height:30px;
width:100px;
cursor :pointer ;
}
.listShow{
position:relative;
background:#eff;
border:1px #ddd solid;
margin:10px;
height:30px;
width:100px;
cursor :pointer ;
}
.comment{
position:absolute;
left:0;
display:none;
position:absolute;
border:1px #ccc solid;
background:#fee;
width:200px;
height:200px;
overflow:hidden;
z-index:100;
}
</style>
</head>
<body>
<div class="" id="show">
0
</div>
<div class="list" id="list1">1
<div class="comment" id="comment1">內容顯示111<br/>
</div>
<div class="list" id="list2">2
<div class="comment" id="comment2">內容顯示222</div>
</div>
<div class="list" id="list3">3
<div class="comment" id="comment3">內容顯示333</div>
</div>
<div><A href="http://www.999jiujiu.com/">http://www.999jiujiu.com/</A></div>
</body>
</html>
<script>
    var zindex=0;
function $id(id){
return document.getElementById(id);
}
var Bind = function(object,fun){
var args = Array.prototype.slice.call(arguments).slice(2);
return function(){
return fun.apply(object,args);
}
}
function addEventHandler(oTarget, sEventType, fnHandler){ 
 if(oTarget.addEventListener){oTarget.addEventListener(sEventType, fnHandler, false);}
 else if(oTarget.attachEvent){oTarget.attachEvent('on' + sEventType, fnHandler);}
 else{oTarget['on' + sEventType] = fnHandler;}
}
var Shower=function(){
this.list=null;
this.comment=null;
this.moveLeft=80;  
this.moveTop=20;
this.height=150;
this.width=250;
this.time=800;
this.init=function(lisObj,comObj){
this.list=lisObj;
this.comment=comObj;
var _this=this;
this._fnMove=Bind(this,this.move);
(function(){
var obj=_this;
addEventHandler(obj.list,"click",obj._fnMove);
})();
};
this.move=function(){
var _this=this;
var w=0; 
var h=0; 
var height=0; //彈出div的高
var width=0;  //彈出div的寬
var t=0;
var startTime = new Date().getTime();//開始履行的時間
if(!_this.comment.style.display||_this.comment.style.display=="none"){
_this.comment.style.display="block";
_this.comment.style.height=0+"px";
_this.comment.style.width=0+"px";
_this.list.style.zIndex=++zindex;
_this.list.className="listShow";
var comment=_this.comment.innerHTML;  
_this.comment.innerHTML="";  //去掉顯示內容
var timer=setInterval(function(){
var newTime = new Date().getTime();
var timestamp = newTime - startTime;
_this.comment.style.left=Math.ceil(w)+"px";
_this.comment.style.top=Math.ceil(h)+"px";
_this.comment.style.height=height+"px";
_this.comment.style.width=width+"px";
t++;
var change=(Math.pow((timestamp/_this.time⑴), 3) +1); //根據運行時間得到基礎變化量
w=_this.moveLeft*change;
h=_this.moveTop*change;
height=_this.height*change;
width=_this.width*change;
$id("show").innerHTML=w;
if(w>_this.moveLeft){
clearInterval(timer); _this.comment.style.left=_this.moveLeft+"px";


_this.comment.style.top=_this.moveTop+"px"; _this.comment.style.height=_this.height+"px";


_this.comment.style.width=_this.width+"px"; _this.comment.innerHTML=comment; //回復顯示內容
}
},1,_this.comment);
}else{
_this.hidden();
}
}
this.hidden=function(){
var _this=this;
var flag=1;
var hiddenTimer=setInterval(function(){
if(flag==1){
_this.comment.style.height=parseInt(_this.comment.style.height)⑴0+"px";
}else{ _this.comment.style.width=parseInt(_this.comment.style.width)⑴5+"px";
_this.comment.style.left=parseInt(_this.comment.style.left)+5+"px";
}
if(flag==1 && parseInt(_this.comment.style.height)<10){
flag=-flag;
}
if(parseInt(_this.comment.style.width)<20){
clearInterval(hiddenTimer);
_this.comment.style.left="0px";
_this.comment.style.top="0px";
_this.comment.style.height="0px";
_this.comment.style.width="0px";
_this.comment.style.display="none";
if(_this.list.style.zIndex==zindex){
zindex--;
};
_this.list.style.zIndex=0;
_this.list.className="list";
}
},1)
}
}
window.onload=function(){
                               //建立各個菜單對象
var shower1=new Shower();
shower1.init($id("list1"),$id("comment1"));
var shower2=new Shower();
shower2.init($id("list2"),$id("comment2"));
var shower3=new Shower();
shower3.init($id("list3"),$id("comment3"));


}
</script>
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 涩涩网页 | 亚洲国产高清视频 | 超碰总站 | 久久精品亚洲精品国产欧美 | 欧美高清在线一区 | 日韩一区三区 | 国产日韩欧美视频 | 最近中文字幕视频大全 | 久久99精品久久久久久噜噜 | 天天操夜夜干 | 欧美日韩国产综合网 | 亚洲国产区 | 精品一区二区不卡 | 涩爱av一区二区三区 | 深夜福利av | 日韩精品视频一区二区三区 | 国产一区二区三区手机在线 | 高清久久久 | 日韩精品中文字幕一区二区 | 久久久久久国裸歌舞团 | 国产在线精品二区 | 成人久久精品 | 一级片久久 | 欧美视频免费看 | 欧美精品成人一区二区三区四区 | 久草一区 | 亚洲最大av网站 | 日韩福利一区 | 国产精品一区二区在线观看网站 | 久久久久亚洲一区二区三区 | 蜜月久综合久久综合国产 | 亚洲精品福利 | 一区二区视频观看 | 在线观看国产一区 | 亚洲免费小视频 | 欧美精品在线一区二区三区 | 欧美性猛xxx | av片在线免费观看 | 精品国产乱码久久久久久影片 | 精品久久久国产 | 国产网站视频 |