wieringen / tinyscrollbar

A lightweight cross browser javascript scrollbar.
http://baijs.com/tinyscrollbar
Other
398 stars 203 forks source link

Fix two resize() handler glitches when disabled #53

Closed crrobinson14 closed 9 years ago

crrobinson14 commented 9 years ago

The resize event handler calls update with a 'relative' scroll. Two things happen in this case:

  1. The 'disabled' class is added MANY times - once for every pixel of resize (see below about debouncing)
  2. If the content size is less than the viewport size, a negative offset is added as part of the relative scroll. This causes the content to 'jump' down by the difference.

Note that it would probably also be a very good idea to 'debounce' this event handler... I wasn't sure what your preferred mechanism for that might be so I didn't include it here.

coveralls commented 9 years ago

Coverage Status

Coverage remained the same at 54.39% when pulling 7c6524564e8121cd3f915c8a6cc0accccf765f25 on crrobinson14:patch-1 into 144b13e317102c9a76123324dde3fd821fa91217 on wieringen:master.

wieringen commented 9 years ago

Thanks that a very good idea!! I will look into it :)