filamentgroup / Overthrow

A tiny, no-frills, framework-independent, targeted overflow: auto polyfill for use in responsive design.
MIT License
906 stars 94 forks source link

overthrow does not fully scroll a container #84

Closed s-thet closed 1 year ago

s-thet commented 9 years ago

noticed this on iPhones with iOS 4.3.5 in built-in mobile safari

to see it, you can create a table in a scrollcontainer which is big enough to cause overflow and give it a border. now scroll a little and try to get it back to "position 0".

the border does not get fully visible in our tests. i think this is caused by the condition in the move function, which checks if the event default should be prevented or changeScrollTarget should be called:

if( ( ty > 0 && ty < scrollHeight - height ) || ( tx > 0 && tx < scrollWidth - width ) )

to my understanding this does not check if there is still overflow in the direction the user desires to scroll, but if the movement the user caused would be bigger than the overflow in the respective direction.

in my case i was able to fix that by checking if the left/right/top/bottom border is reached, like

, atLeftBorder = scrollL === 0
, atRightBorder = scrollL + width === scrollWidth
, atTopBorder = scrollT === 0
, atBottomBorder = scrollT + height === scrollHeight

i think if no border is reached yet, the scroll target should not be changed, but the default should be prevented