chatscroll.Pane intended to be used as a constructor. You would create an instance like this:
new chatscroll.Pane('somescrollContainerId');
The return value becomes reusable if you assign it to a variable.
var chatScrollPane = new chatscroll.Pane('somescrollContainerId');
The incoming scrollContainerId will be the identifier ( id ) of the DIV element in your HTML document with which you want to use this object.
You do not need to declare it in window.onload , but that will certainly not hurt. All the constructor does is create a new object, set the this value for this new object, create and configure the bottomThreshold and scrollContainerId , and then return this new object when the constructor completes.
Just make sure that you never call the activeScroll function until the document has been fully analyzed, as it really is included in your document to retrieve and manipulate the elements.
source share