Is there a destroy method for FlexSlider

后端 未结 3 976
走了就别回头了
走了就别回头了 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:58

    The most easy way is to remove the flexscroll from element dataset

    function flexInit() {
        $('.flexslider').flexslider({
            animation: "slide",
            controlsContainer: ".paginator",
            manualControls: 'a',
            after: function(slider){
                if(slider.atEnd == true)    {
                    slider.addSlide(galBuild());
                }
            }
        });
    }
    //this remove flexslider form element dataset
    $('.flexslider').removeData("flexslider");
    

    and now you are free to call

    flexInit();
    

    and your flexslider will be recreated.

提交回复
热议问题