Jquery tools slideshow - changing effect on window resize

158 Views Asked by At

I'm using this plugin for slideshow: http://jquerytools.org/demos/tabs/slideshow.html

I want to change slideshow effect on window resize. My code: http://jsfiddle.net/genesiss/5L2CN/5/

var initSlideshow = function() {

    var effect = 'fade';
    if ($(window).width() < 300) {
        effect = 'default';
    }

    $(".slidetabs").tabs(".images > div", {

    effect: effect,
    fadeOutSpeed: "slow",

    rotate: true

  }).slideshow({interval: 100});
};


$(function() {
  initSlideshow();
  $(".slidetabs").data('slideshow').play();

   $(window).resize(function () {
        $(".slidetabs").data('slideshow').stop();
        $(".slidetabs").tabs('destroy');
        initSlideshow();
        $(".slidetabs").data('slideshow').play();
    });


});

It seems that slideshow effect is always the same - one that is set at first initialization. You can see that by resizing 'Result' window in jsfiddle and noticing that it still has 'fade' efect (two slides on the screen at the same time, one fading away).

How could I change slideshow effect after first initialization?

0

There are 0 best solutions below