getScrollbarWidth - Get current scrollbar width
getScrollbarWidth() // Number
Get the current device scrollbar width, creating some hidden elements and measuring the difference.
The function has no parameters.
Type/Value | Description |
---|---|
Number | Scrollbar width in pixels |
getScrollbarWidth(); // 16
getVisibility - Get element vertical visibility
getVisibility( elem, container = null ) // Object
Get element vertical visibility, considering scroll position, supplies relative and absolute values.
Parameter | Type | Default | Description |
---|---|---|---|
elem | HTMLElement | - | Element to get visibility data for |
container | HTMLElement | documentElement | Relative container |
Type/Value | Description |
---|---|
Object | Visibility object { elem : Number %, view : Number %, height : Number pixels } |
getVisibility( document.getElementById( 'section' ) ); // { elem : 27.4578567, view : 42.5678, height : 347 }