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();
答案 0 :(得分:0)
答案:
129K ./bin/dirname
33M total
132K ./bin/uname
33M total
207K ./bin/sha1sum
33M total
156K ./bin/truncate
33M total
311K ./bin/pr
34M total
172K ./bin/printf
34M total
138K ./bin/pathchk
34M total
答案 1 :(得分:0)
按照@АндрейОхотников的答案,答案应该实际上是<instance>.scroll.max.x
,而不是x.max
:
const scrollBar = $(jsScrollPageContainer).overlayScrollbars({
className: "os-theme-dark",
callbacks: {
onScroll: function(e) {
const scrollInfo = scrollBar.scroll();
const max = scrollInfo.max.x;
const scrollLeft = e.target.scrollLeft; // same as `scrollInfo.position.x`
const scrollTop = e.target.scrollTop; // same as `scrollInfo.position.y`
// other logic
}
}
}).overlayScrollbars();
完整的对象供参考: