Search code examples
transitionjssor

Jssor random transition


Having 360+ transition effects is cool, but I have only 10 slides. How can I give them fancy transitions equal chance to show off? The transition effect is defined in option object before the JssorSlider object is created. It seems to me I can only pick 1 of the 360 and set it in the option. Can I have random transition effect for each transition? A.K.A, after the JssorSlider is created, can I still apply new option values to it?


Solution

  • You can specify a transition array with multi transitions. And you can set $TransitionsOrder: 0 to let it play transition randomly.

    jQuery(document).ready(function ($) {
        //Define an array of slideshow transition code
        var _SlideshowTransitions = [
        { code1 },
        { code2 },
        { code3 }
        ];
        var options = {
            $AutoPlay: true,
            $SlideshowOptions: {
                    $Class: $JssorSlideshowRunner$,
                    $Transitions: _SlideshowTransitions,
                    $TransitionsOrder: 0,    //The way to choose transition to play slideshow, 1: Sequence, 0: Random 
                    $ShowLink: true
                }
        };
        var jssor_slider1 = new $JssorSlider$('slider1_container', options);
    });
    

    After the JssorSlider is created, you can also set transitions dynamically by api call $SetSlideshowTransitions(transArray).

    jssor_slider1.$SetSlideshowTransitions(transArray);
    

    Reference:

    http://www.jssor.com/development/slider-with-slideshow-jquery.html http://www.jssor.com/development/reference-options.html http://www.jssor.com/development/reference-api.html