1

该滑块 FancyTransitions 不支持随机效果。所以要解决这个问题,我需要effect: 'curtain'随机的值,可以是“窗帘”、“拉链”或“波浪”。除非有更好的解决方法。

<script type="text/javascript">
    $(document).ready( function(){
        $('#slideshowHolder').jqFancyTransitions({
        width: 500, // width of panel
        height: 333, // height of panel
        strips: 10, // number of strips
        delay: 4000, // delay between images in ms
        stripDelay: 50, // delay beetwen strips in ms
        titleOpacity: 0.7, // opacity of title
        titleSpeed: 1000, // speed of title appereance in ms
        position: 'alternate', // top, bottom, alternate, curtain
        direction: 'random', // left, right, alternate, random, fountain, fountainAlternate
        effect: 'curtain', // curtain, zipper, wave
        navigation: false, // prev next and buttons
        links : false // show images as links                                                   });
    });
</script>
4

4 回答 4

1

你的意思是

effect: ['curtain', 'zipper', 'wave'][Math.floor(Math.random() * 3)] 

?

于 2012-05-02T22:19:34.947 回答
0

尝试类似...

var effect;
var i = Math.floor((Math.random()*3)+1);

if (i==1) effect = "curtain";
if (i==2) effect = "zipper";
if (i==3) effect = "wave";
于 2012-05-02T22:22:57.077 回答
0
var effects = ["curtain", "zipper", "wave"];

$(document).ready( function(){
    $('#slideshowHolder').jqFancyTransitions({
    ...
    effect: effects[Math.floor(Math.random() * 3)], // curtain, zipper, wave
    ...
    });
});
于 2012-05-02T22:30:40.150 回答
0

插件没有过渡回调,因此您需要对其进行修改以允许随机化效果参数。

在插件代码中添加params.effect = ['curtain', 'zipper', 'wave'][Math.floor(Math.random() * 3)];$.transition函数的顶部会随机设置每个过渡的效果参数。未经测试,但这应该是方式。

我强烈建议使用更好的幻灯片插件,例如循环nivo-slider

于 2012-05-02T23:50:54.353 回答