漂亮的图片移动控制特效

<style type="text/css">
#mainid{
position:absolute;right:5px;top:10px;height:435px;width:650px;overflow:hidden;background:#fff;left: 400px;border: 3px solid

#666666;
} .imgbox{
position:absolute; left:35px; margin-top:20px; top:105px; z-index:90; width:100px;height:100px;background:#ffffff
}
.moveimgbox{
position:absolute; left:700px; margin-top:20px; top:105px; z-index:90; width:100px;height:100px;background:#ffffff
}
</style>

<script>
var ticked=0;
var okayToGo = true;
var currentCreature = 1;
var forwardBackward = 1;
var firstnum = 1;
var secnum = 2;
var tounum=1;
function moveItem(firstnum,secnum){

if(okayToGo&& firstnum != secnum){ tounum=firstnum;
document.getElementById("y"+firstnum).style.zIndex = 50+10*forwardBackward;
document.getElementById("y"+secnum).style.zIndex = 50+20*forwardBackward;
startTheMove =window.setInterval(function(){rightOrLeft(firstnum,secnum)},20);
}

}

function rightOrLeft(firstnum,secnum) {

if (ticked == 1020) {
window.clearInterval(startTheMove); ticked = 0; forwardBackward = 1; okayToGo = true;
} else {
okayToGo = false; thisAngle = (Math.PI/2)*(ticked/1000); document.getElementById("y"+firstnum).style.left = " "+(735-

Math.sin(thisAngle)*700)+"px";
document.getElementById("y"+firstnum).style.top = " "+(105-(forwardBackward*Math.cos(thisAngle)*55))+"px";

document.getElementById("y"+secnum).style.left = " "+(735-Math.sin(thisAngle+Math.PI/2)*700)+"px";
document.getElementById("y"+secnum).style.top = " "+(105-(forwardBackward*Math.cos(thisAngle+Math.PI/2)*55))+"px";
ticked += 20;
}

}
</script>

<a href="javascript:moveItem(1,tounum);"><img src="http://www.3lian.com/edu/img/js/200909/s1.jpg" width="129"

height="97"></a>
<a href="javascript:moveItem(2,tounum);"><img src="http://www.3lian.com/edu/img/js/200909/s2.jpg" width="134"

height="100"></a>
<br/>
<a href="javascript:moveItem(3,tounum);"><img src="http://www.3lian.com/edu/img/js/200909/s3.jpg" width="134"

height="100"></a>
<a href="javascript:moveItem(4,tounum);"><img src="http://www.3lian.com/edu/img/js/200909/s4.jpg" width="101"

height="134"></a>

<div align="right" id="mainid">

<div id="y1" class="imgbox"><img src="http://www.3lian.com/edu/img/js/200909/1.jpg" width="500" height="300"></div>
<div id="y2" class="moveimgbox"><img src="http://www.3lian.com/edu/img/js/200909/2.jpg" width="500" height="300"></div>

<div id="y3" class="moveimgbox"><img src="http://www.3lian.com/edu/img/js/200909/3.jpg" width="500" height="300"></div>
<div id="y4" class="moveimgbox"><img src="http://www.3lian.com/edu/img/js/200909/4.jpg" width="500" height="300"></div>

</div>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值