0

with Anythingslider and Ajax I made a slider that produce infinity slides. That works great. But I have to clean the old slides, that the page get not to big and kill the RAM.

I'm trying the following to have the possibility to go always 10 sliders back:

  onSlideComplete: function(slider) {


     if (slider.currentPage >= 21) {

    $('#slider1 > li:not(.cloned)').slice(0, 9).remove();
    $('#slider1').anythingSlider(11); // update the slider


 }

      }

I dont want the easing effect when I change the slider number to correct the deletion. Is that possible. Or there some better ways?

Thank you

4

1 回答 1

0

我没有机会对此进行测试,但请尝试以下操作:

onSlideComplete: function(slider) {

    if (slider.currentPage >= 21) {

        $('#slider1 > li:not(.cloned)').slice(0, 9).remove();
        slider.currentPage = 11;
        slider.updateSlider();
    }

}

如果这不起作用,请尝试以下操作:

onSlideComplete: function(slider) {

    if (slider.currentPage >= 21) {

        $('#slider1 > li:not(.cloned)').slice(0, 9).remove();
        slider.currentPage = 11;
        slider.updateSlider();

        // (page, autoplay?, callback, time)
        slider.gotoPage(11, false, {}, 0)
    }

}

如果这仍然不起作用,请updateSlider()移动gotoPage. 毕竟,如果它仍然不起作用,我想我可能需要修改插件。

于 2012-03-07T17:06:42.843 回答