Is there a destroy method for FlexSlider

后端 未结 3 953
走了就别回头了
走了就别回头了 2021-01-03 01:36

I am trying to reinitialize FlexSlider with out page refresh when a new gallery listing is called asynchronously.

I would think the routine below would work but it d

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 01:57

    Rob i investigated this and find the solution

    You need to modify your functions like this

    function flexInit() {
        $('.flexslider').flexslider({
            animation: "slide",
            controlsContainer: ".paginator",
            manualControls: 'a',
            after: function(slider){
                if(slider.atEnd == true)    {
                    slider.addSlide(galBuild());
                }
            }
        });
    }
    
    
    function galBuild() {
       $.getJSON("/gallery/next/"+galID, function (data) {
        var results = data.objects;
        var i = 0;
        $.each(results, function () {
           return ('
  • ' + results[i].title + '

    ' + results[i++].caption + '

  • '); }); }); } flexInit();

    Also you need to do some cosmetic changes in flexSlider.js file in slider.update function. right now its not checking the position variable if it comes undefined, so you will have to check this as well.

提交回复
热议问题