100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > html侧边栏缩小出现图标 可收缩侧边栏

html侧边栏缩小出现图标 可收缩侧边栏

时间:2023-11-23 07:18:12

相关推荐

html侧边栏缩小出现图标 可收缩侧边栏

该楼层疑似违规已被系统折叠隐藏此楼查看此楼

*{

margin: 0;

padding: 0;

}

#div1{

width: 200px;

height: 200px;;

background: red;

position: relative;

left:-200px;

top: 0;

}

#div1 span{

width: 20px;

height: 50px;

background: blue;

position: absolute;

left: 200px;

top: 75px;

}

window.οnlοad=function(){

var oDiv=document.getElementById("div1");

oDiv.οnmοuseοver=function(){

startMove(0);

}

oDiv.οnmοuseοut=function(){

startMove(-200);

}

}

var timer=null;

function startMove(iTarget){

clearInterval(timer);

var oDiv=document.getElementById("div1");

timer=setInterval(function(){

var speed=0;

if(oDiv.offsetLeft>iTarget){

speed=-10;

}

else

{

speed=10;

}

if(oDiv.offsetLeft==iTarget){

clearInterval(timer);

}else{

oDiv.style.left=oDiv.offsetLeft+speed+"px";

}

},30);

}

菜单

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。