wieringen / tinyscrollbar

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

Issue with update dinamicaly scrooll #71

Open catiraumihail opened 7 years ago

catiraumihail commented 7 years ago

Sorry for my bad english :).

Update to N px issue - content bottom must be at the bottom of viewport.

How to check this issue. I have in content some blocks (elements). I try to dynamically scroll to this elements. Call method update(element.top), if this is last element there is space above it instead to place this item at the bottom of viewport.

How to fix:

//after line 184: check if content bottom is the same as  viewport bottom
    if((this.contentSize - this.contentPosition - 1) < this.viewportSize){
            // set viewport bottom = content bottom
    this.contentPosition = Math.max(this.contentSize - this.viewportSize, 0);
}