Answer the question
In order to leave comments, you need to log in
Why doesn't jquery want to execute ScrollToTop on click on slick plugin element?
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
Understood. Decision:
jQuery('.name').on('beforeChange', function(event, slick, currentSlide, nextSlide) {
}
You most likely need to add the class to the list when the slider is initialized. Because initially there is no such element, it is created dynamically. Then you can access this element
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question