Support » Plugin: WP Responsive Recent Post Slider/Carousel » Reinitialize after Ajax load

  • Resolved pattihis

    (@pattihis)


    This is a great plugin but I am using it on a website that has ajax loading navigation between pages. On initial load slider works great. If I browse to some posts and return to homepage then slider is not working.

    We should call something like this after the ajax loading:
    jQuery('#wprpsp-slider-1').slick();
    to re-initialize the slider, but how can we call it with all the options?

    Thank you for your time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rafik

    (@rafikwp)

    Hello,

    I have no idea how and where you using ajax but you can try below slick initialize code.

    Put below code in the ajax success event.

    $( '.wppsac-post-slider' ).each(function( index ) {
    		
    		var slider_id   	= $(this).attr('id');			
    		var slider_conf 	= $.parseJSON( $(this).closest('.wppsac-slick-slider-wrp').find('.wppsac-slider-conf').attr('data-conf'));
    
    		if( typeof(slider_id) != 'undefined' && slider_id != '' ) {
    			jQuery('#'+slider_id).slick({
    				lazyLoad        : slider_conf.lazyload,
    				dots			: (slider_conf.dots) == "true" ? true : false,
    				infinite		: true,
    				arrows			: (slider_conf.arrows) == "true" ? true : false,
    				speed			: parseInt(slider_conf.speed),
    				autoplay		: (slider_conf.autoplay) == "true" ? true : false,
    				autoplaySpeed	: parseInt(slider_conf.autoplay_interval),
    				slidesToShow	: 1,
    				slidesToScroll	: 1,
    				rtl             : (slider_conf.rtl) == "true" ? true : false,
    			});
    		}
    	});
    pattihis

    (@pattihis)

    Exactly what I was looking for. Worked like a charm, thank you!

    Plugin Support Ketan Patel

    (@patelketan)

    Hello

    If you like this Plugin Please give your Important Rate and Review Here…

    Thanks,

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.