Answer the question
In order to leave comments, you need to log in
How to make jquery move up when slick-dots is clicked?
Friends, hello everyone!
I'm confused, please help me figure it out.
With the help of slick I build a slider, the dots sign is set for the slider. Buttons appear, it is necessary that by clicking on any of the buttons, jquery scrolls the page up. What I do: I
add the required class and the second feature to slick-dots when loading:
jQuery(".slick-dots").addClass("page-scroll").attr('data-scrollid', 'up');
jQuery(".page-scroll").click(function() {
pagcenter();
jQuery('html, body').animate({
scrollTop: jQuery( '#' + jQuery(this).data("scrollid") ).offset().top - 120
}, 1000, 'swing');
});
Answer the question
In order to leave comments, you need to log in
jQuery('html').delegate('.page-scroll', 'click', function() {
pagcenter();
jQuery('html, body').animate({
scrollTop: jQuery( '#' + jQuery(this).data('scrollid') ).offset().top - 120
}, 1000, 'swing');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question