Skip to content

Instantly share code, notes, and snippets.

@ndunk28
Last active March 10, 2022 18:31
Show Gist options
  • Save ndunk28/c54d93a4776105033698e548a060c9e8 to your computer and use it in GitHub Desktop.
Save ndunk28/c54d93a4776105033698e548a060c9e8 to your computer and use it in GitHub Desktop.
slick js only on mobile
// 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);
}
});
};
@nathanhertsoen
Copy link

That's my boi !

@pechka1
Copy link

pechka1 commented Jul 15, 2021

GooD

@Ramielson-Edgar
Copy link

nice, what i need, thank you )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment