Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › Ajax messing up Slick js script
Tagged: ajax, jquery conflict
- This topic has 19 replies, 2 voices, and was last updated 5 years, 1 month ago by Trevor.
-
Laurent Mengin(Private) February 26, 2019 at 11:24 am #203284
I have this code in a separate js file where I initalize all jquery plugins :
jQuery(document).ready(function($){ $(".visuels-realisations").slick({ dots: false, infinite: true, autoplay: false, autoplaySpeed: 10000, slidesToShow: 2, slidesToScroll: 1 }); });
Trevor Moderator(Private) February 26, 2019 at 11:32 am #203286Ah, OK, try this then:
<script>(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ $('.visuels-realisations').slick('unslick'); $(".visuels-realisations").slick({ dots: false, infinite: true, autoplay: false, autoplaySpeed: 10000, slidesToShow: 2, slidesToScroll: 1 }); }); }(jQuery));</script>
Laurent Mengin(Private) February 26, 2019 at 12:02 pm #203288Like that in the plugin or in the js file ? If in the js file should I change it to :
jQuery(document).ready(function($){ "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ $('.visuels-realisations').slick('unslick'); $(".visuels-realisations").slick({ dots: false, infinite: true, autoplay: false, autoplaySpeed: 10000, slidesToShow: 2, slidesToScroll: 1 }); }); });
Or leave it as is ?
Because I tried on local to paste both your code and the one I pasted above un the js file and the sliders weren’t working anymore.
Trevor Moderator(Private) February 26, 2019 at 12:12 pm #203292Your js file might look like this now:
jQuery(document).ready(function($){ $(".visuels-realisations").slick({ dots: false, infinite: true, autoplay: false, autoplaySpeed: 10000, slidesToShow: 2, slidesToScroll: 1 }); }); (function ( $ ) { $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ $('.visuels-realisations').slick('unslick'); $(".visuels-realisations").slick({ dots: false, infinite: true, autoplay: false, autoplaySpeed: 10000, slidesToShow: 2, slidesToScroll: 1 }); }); }(jQuery));
Laurent Mengin(Private) February 26, 2019 at 12:16 pm #203296I copied it exactly as you pasted in my js file but no results.
Trevor Moderator(Private) February 26, 2019 at 3:10 pm #203315This has pretty much exhausted all my ideas. Does it have javascript errors? Is the content completely missing, or is it just hidden?
Laurent Mengin(Private) February 26, 2019 at 3:30 pm #203325He’s a screen of the errors : https://i.ibb.co/mctpjVB/Capture-d-e-cran-2019-02-26-a-16-28-31.png
And of the result : https://i.ibb.co/yVVQmfd/Capture-d-e-cran-2019-02-26-a-16-28-43.png
It displays the images as if the slider js was not installed.Trevor Moderator(Private) February 26, 2019 at 3:39 pm #203327Ah OK. Try removing that line then?
$('.visuels-realisations').slick('unslick');
Trevor Moderator(Private) February 26, 2019 at 3:50 pm #203347Yay!
I will close this thread for now.
-
AuthorPosts
The topic ‘Ajax messing up Slick js script’ is closed to new replies.