2009-12-09 75 views
0

我創建一個jquery幻燈片,我想要2張圖片1從左側滑入,另一張從右側滑入。最後,圖片可以從左側滑入,但無法滑向左側。 izit我的代碼有什麼不妥?任何建議?jquery幻燈片問題。任何人都可以幫助

<script type="text/javascript"> 
    $(document).ready(function() { 
    $('.slideshow').cycle({ 
    fx: 'custom', 
    cssBefore: { 
     top: 0, 
     left: 0, 
     width: 0, 
     height: 0, 
     zIndex: 1 
    }, 
    animIn: { 
     right: 0, 
     width: 200, 
     height: 200 
    }, 
    animOut: { 
     top: 200, 
     left: 200, 
     width: 0, 
     height: 0 
    }, 
    cssAfter: { 
     zIndex: 0 
    }, 
    delay: -1000 
}); 
    $('.slideshow2').cycle({ 
    fx: 'custom', 
    cssBefore: { 
     top: 0, 
     left: 0, 
     width: 0, 
     height: 0, 
     zIndex: 0 
    }, 
    animIn: { 
     width: 200, 
     height: 200 
    }, 
    animOut: { 
     top: 200, 
     right: 200, 
     width: 0, 
     height: 0 
    }, 
    cssAfter: { 
     zIndex: 0 
    }, 
    delay: -1000 
}); 
}); 
</script> 
+1

您可以從左側滑入,但同時不能從左側滑入? – Ikke 2009-12-09 07:34:07

+0

我認爲'左'可以,'正確'不能。 :P – 2009-12-09 07:34:56

+0

與ikke – Sarfraz 2009-12-09 07:35:19

回答

0

this the effect您是在找?

$(document).ready(function() { 
    $('.slideshow').cycle({ fx: 'custom', cssBefore: {top:0,left:0,width:0,height:0,zIndex: 1}, 
    animIn: {right:0,width:240,height:160}, 
    animOut: {top:0,left:0,width:0,height:0}, 
    cssAfter: {zIndex:0}, 
    delay: -1000 }); 
    $('.slideshow2').cycle({ fx: 'custom', cssBefore: {top:0,left:240,width:0,height:0,zIndex:0}, 
    animIn: {left:0,width:240,height:160}, 
    animOut: {top:0,left:240,width:0,height:0}, 
    cssAfter: {zIndex:0}, 
    delay: -1000 }); 
}); 

我改變了代碼,使得.slideshow2元件,在它們的實際寬度,240px在這種情況下100%開始與他們的左側。 animIn將左側更改爲0animOut將其更改回240。這會導致圖像顯示爲從包含框右側增長。

+0

這是我想要的效果。 thx很多^^ – 2009-12-09 08:20:45