Answer the question
In order to leave comments, you need to log in
Why doesn't the second callback on scroll work?
Given: A
page where all the scrollbars are customized with the simplebar plugin. According to the docs, in order to subscribe to a scroll, you need to hang up a listener on the element returned by the simplebar.getScrollElement() function.
There is a table on the page that scrolls horizontally at non-wide resolutions.
Needed:
Simulate the behavior of the position sticky header so that the header is friendly with the horizontal scrolling of the table.
What's wrong:
At resolutions without a horizontal table scrollbar, everything works well. I subscribed to the document scroll, stuck a header with the necessary styles and everything is ok. But when there is a horizontal scrollbar, the header remains fixed on the window and does not blend with the table. To synchronize it, I decided to subscribe to the horizontal scrollbar of the table, just like the scroll of the entire page
. Everything works as it should. fix and stick work out at the right time
scrollNode.scroll (e) ->
hOffTop = header.offset().top - headerHeight
if hOffTop <= 0
lastScrollPoint = header.parents("div:first").offset().top - headerHeight
stickHead.fix(header, {
offset: headerHeight,
event: e
})
if lastScrollPoint > 0
stickHead.stick(header)
if window.xScrollbars
xScrollbars = window.xScrollbars
xScrollbars.forEach (scrollbar, index) ->
el = scrollbar.getScrollElement()
posibleFixedHeader = $(el).find(selector)
if posibleFixedHeader.length > 0
console.log(el)
el.addEventListener "scroll", (e) ->
console.log('scroll')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question