我有三张图片: 1.jpg,2.jpg,3.jpg & <img id="add" src="1.jpg"></img> --这个图像的宽度、高度和位置都是根据需要设置的,并且工作正常。我已经应用JQUERY属性在上面的图像之间切换&它也工作得很好。
但我希望图像以滑动的方式变化,即,1.jpg以滑动的方式向左滑动,然后在2.jpg的位置消失和拖放,等等,在特定的时间间隔内继续。
希望我很清楚..。
致以问候。
发布于 2014-03-05 13:21:51
感谢大家的努力,但是,我自己配置的.以下是它的工作原理:
index.html:
<html>
<head>
<script src="jquery.js"></script>
<script src="slide.js"></script>
</head>
<body>
<div >
<img id="pic1" src="1.jpg"style="width:0px;height:120px;"/><img id="pic2" src="2.jpg" style="width:160px;height:120px;"/>
</div>
</body>
</html>slide.js
$("document").ready(function(){
var img_l=$("#pic1");
var img_r=$("#pic2");
setInterval(function(){
img_l.animate({width:'160px'},1000);; //animating the image t colapse
img_r.animate({width:'0px'},1000);; //animating the image t expand
var temp_var=img_l; //swaping values to revert previous action
img_l=img_r;
img_r=temp_var;
},3000); //repeating the effect every 3 seconds
});这在我的需求上做得很好,在所有领先的浏览器中都有完全相同的行为.谢谢。
https://stackoverflow.com/questions/22165988
复制相似问题