Last active
March 10, 2022 18:31
-
-
Save ndunk28/c54d93a4776105033698e548a060c9e8 to your computer and use it in GitHub Desktop.
slick js only on mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// slider | |
$slick_slider = $('.slider'); | |
settings_slider = { | |
dots: false, | |
arrows: false | |
// more settings | |
} | |
slick_on_mobile( $slick_slider, settings_slider); | |
// slick on mobile | |
function slick_on_mobile(slider, settings){ | |
$(window).on('load resize', function() { | |
if ($(window).width() > 767) { | |
if (slider.hasClass('slick-initialized')) { | |
slider.slick('unslick'); | |
} | |
return | |
} | |
if (!slider.hasClass('slick-initialized')) { | |
return slider.slick(settings); | |
} | |
}); | |
}; |
Life Saver!
thanks!
saved my day 👍
That's my boi !
GooD
nice, what i need, thank you )
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome!