Is there a destroy method for FlexSlider

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

    i'm using different approach i.e.

    you've started one flexslider:

    
        $('#element).flexslider({
          animation: "slide",
          controlNav: false,
          directionNav: true
        });
    
    

    when I want to change slides in previously created slider and restart it, id do following things:

    • creating temporaty div:

      $('#element).before('
          
      ');
    • delete div with previously created slider

      $('#element).remove();
      
    • insert new list of slides into temporary div:

      var html = `
      
    • start flexslider on temp div

      $('#element_temp').flexslider({
        animation: "slide",
        controlNav: false,
        directionNav: true
      });
      
    • change div ID from element_temp to element

      $('#element_temp').attr('id','element');
      

    and it works with multiple flexliders

提交回复
热议问题