Find the scroll position when scrolling

The name of the picture


Find the scroll position when scrolling



I'm using this library for the scroll https://kingsora.github.io. How do you know that the element is completely scrolled? I can nyyati only the initial point where scroll = 0, but how do you know that the element is scrolled to the end?


var instance = $("#road-scroll")
.overlayScrollbars({
callbacks: {
onScrollStop: function(e) {
scrollLeft = e.target.scrollLeft;

if (scrollLeft === 0) {
btnL.removeClass("btn-active");
}

if (scrollLeft > 0) {
btnL.addClass("btn-active");
}

}
}
})
.overlayScrollbars();




1 Answer
1



Answer:


var instance = $("#road-scroll")
.overlayScrollbars({
callbacks: {
onScrollStop: function(e) {
scrollLeft = e.target.scrollLeft;
var scrollInfo = instance.scroll();
let max = scrollInfo.x.max;

if (scrollLeft === 0) {
btnL.removeClass("btn-active");
}

if (scrollLeft > 0) {
btnL.addClass("btn-active");
}

if (scrollLeft >= max) {
btnR.removeClass("btn-active");
}

if (scrollLeft < max) {
btnR.addClass("btn-active");
}

}
}
})
.overlayScrollbars();






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

CRM reporting Extension - SSRS instance is blank

Keycloak server returning user_not_found error when user is already imported with LDAP