Scrolling provides a simple stylable scrollbar, by using a scrollable div and hiding the browser provided scrollbars.
Native browser scrollbar styling is used for webkit and firefox browsers.

innovaphone.ui1.Scrolling(style, maxWidth, maxHeight, width, color, cstyle)

Constructor function to create the scrolling element.

Style attribute for the outer html. This can for example be used to size and position the element.
Can be used, if the element does not have a fixed size. The size is determined automatically by the content. If the content is bigger than theses values, the scrollbars appear. A value of 0 is used for the normal automatic mode so that a scrollbar is displayed if needed. If -1 is used, the respective scrollbar is not displayed. If -2 is is used the respective scrollbar is always displayed.
The width of the scrollbar in pixel.
The color of the scrollbar.
Styling which is used for the content div. Can be used for things like setting padding.


The ui1.Div element used for the content
Function to add content (calls content.add).
Function to rem content (calls content.rem).
Functions which returns the first child of content (calls content.firstChild).
Property which can be set to a function, which is called when the scroll position changes
Set the top scroll position to top
Returns the top scroll position.
Set the bottom scroll position to bottom.
Returns the bottom scroll position.
Scroll to bottom.
Returns true if scroll is at bottom
Returns true if scroll is at top
Returns the height of the content
scrollIntoView(node, scrollIntoViewOptions)
Scrolls to the specified node, which is either an innovaphone.ui1.Node or a dom node.
The parameter scrollIntoViewOptions is currently just used in webkit browsers, as the dom node scrollIntoView function is directly used.
For other browsers, the own scrollbar implementation is used until these browsers support styling of a scrollbar.


The element is build up from the following div elements (from the outside to the inside):


This div has no style set by the element itself. The style attribute is set by the application. It must be a absolute or relative positioned block element. The maxWidth, maxHeight arguments refer to the outer size of this element.

It contains the following additional divs:

vb, v
These elements display the vertical scrollbar. vb defines the size and position and v displays the actual moving bar.
hb, h
Same as vb, v but for the horizontial scrollbar


Absolute position inside bars. It defines the actual visible content. If scrollbars are visible it uses right and/or bottom of 8px to make room for the scrollbars. The overflow:hidden property makes shure the browser scrollbars from the content are not visible


The actually scrolling element. When resize is called the first time, the right and bottom properties are set to a negative value representing the actual width of the browser scrollbars, so that the browser scrollbars are moved out of the visible area. If a scrollbar needs to be displayed, a positive value representing the size of the scrollbar is added, so that the actual scrollbar is displayed at the same place as the browser scrollbar would be.


A relative positioned inline-block element. The size of this is used to set the outer size automatically for automatic sizing

CSS styling for webkit and firefox


You can put the following CSS to your CSS file to style the scrollbars in Webkit browsers:

div::-webkit-scrollbar {
div::-webkit-scrollbar-thumb {
  background-color: var(--accent); /* or whatever color you want */


div {
  scrollbar-color: var(--accent) transparent !important; /* !important overrides the javascript default setting */
  scrollbar-width: thin !important;