首页 > 网站 > WEB开发 > 正文

内部分享栏

2024-04-27 15:05:40
字体:
来源:转载
供稿:网友
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>运动一(分享栏)</title><style>#div1{width: 150px; height: 200px; background: green; position: absolute; left: -150px;}#div1 span{position:absolute; width: 20px; height: 60px; background: blue; right: -20px; top: 70px;}</style></head><body><div id="div1"><span>分享到</span></div><script>var speed=0;   var timer=null;var oDiv1=document.getElementById('div1');function move(target)//运动框架{if(oDiv1.offsetLeft<target)speed=15;elsespeed=-15;clearInterval(timer);timer=setInterval(function(){if(oDiv1.offsetLeft==target){   clearInterval(timer);}else{oDiv1.style.left=oDiv1.offsetLeft+speed+'px';}            },30);}oDiv1.onmouSEOver=function(){move(0);}oDiv1.onmouseout=function(){move(-150);}</script></body></html>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表