albertogasparin/Optiscroll

Window scroll event and offset lost

Bram-Zijp opened this issue · 2 comments

Using the scrollbar on the body element removes the window scroll event and offset variables

Hi @Bram-Zijp, could you be more specific? I mean, were you expecting the window.onscroll event to be fired by attaching Optiscroll to the body?
If so, I'm sorry but that's not going to happen. Optiscroll makes the body element scrollable though the event will be body.onscroll. I've found no reliable way to hide scrollbars at window level, because the <html> element cannot have other children other than head and body.
Moreover, if I remember well, Firefox handles the body scroll in a different way that Chrome/Safari,
so my suggestion is to add overflow: hidden to both html and body and init Optiscroll on a fullscreen div

That's to bad. Some plugins use the window object to figure scroll position. Maybe it's possible to replicate the body object onto the window object. But I have no idea about the performance impact this would give if at all possible.