2012-06-29 228 views
0

我有一个幻灯片.....幻灯片,幻灯片效果

 <script type="text/javascript"> 
    <!-- 
    var image1=new Image() 
    image1.src="slide-image-1.png" 
    var image2=new Image() 
    image2.src="slide-image-2.png" 

    //--> 
    </script> 

<img name="slide" class="image1" src="slide-image-1.png" /> 
<script> 
<!-- 
//variable that will increment through the images 
var step=1 
function slideit(){ 
//if browser does not support the image object, exit. 
if (!document.images) 
return 
document.images.slide.src=eval("image"+step+".src") 
if (step<2) 
step++ 
else 
step=1 
//call function "slideit()" every 2.5 seconds 
setTimeout("slideit()",4000) 
} 
slideit() 
//--> 
</script> 

我想改变在幻灯片通过水平滚动从右到左(我希望这是有道理的相互替换的方式)。这种类型的过渡会被称为什么?它可以通过简单的几行来完成吗?

(我知道这可能是一个经验丰富的网页设计师一个简单的事情,但香港专业教育学院才刚刚开始,不知道因为什么,这将是)

+2

首先的动画,不使用'eval'。你不需要它,这是不好的做法。 – TheZ

+0

即时通讯对不起,请问是什么? – user1491979

+0

+1,如果你将它重构为一个数组,那么eval甚至是不必要的。 – gcochard

回答

1

你可以使用jQuery来做到这一点。你可以找到一些插件here

0

您可以简单地使用jQuery来获得这样的效果我已经添加的伪码两个div

<body> 
    <div id="divone" style="background-color:#808080;width:150px;height:250px;"></div> 
    <div id="div1" style="background-color:#0026ff;width:150px;height:250px;display:none;"></div> 
    <script> 
     //jQuery("#divone").animate({ opacity: 0.10 }, 5000); 
     //jQuery("#divone").fadeOut(5000); 
     jQuery("#divone").fadeOut(5000, function() { jQuery("#div1").fadeIn(5000) }) 
    </script> 
</body>