Skip to content

popov654/xscroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

xscroll

A library adding "native" scrolling behavior to any HTML element (textareas, divs, etc.) Inertial scrolling on touch devices is also supported by default

Usage

Please see the exa,ples, they are quite self-explanatory.

Some hints:

  1. You have to initialize the containers explicitly in your code somewhere, e.g. on page load.
  2. CSS ctyling is up to you, you can find all class names in the examples
  3. You can use scrollLeft, scrollTop, scrollWidth and scrollHeight as it would be a native scroll
  4. When there is little content the scrollbars will disappear and then come back when necessary thanks to the DOM modification watching
  5. Everything about sizing and behavior is controlled via attributes. The most useful are:
Attribute Description
scroll-size the width of the scrollbar
button-size the width of the buttons along the scroll axis
thumb-length the width of the thumb along the scroll axis
thumb-width the width of the thumb along the cross-axis
(the thumb can be narrower or wider than the scrollbar)
scroll-delta one mouse wheel tick will scroll the contents by this amount of pixels
viewport-width the width of the viewport
viewport-height the height of the viewport
xscroll-allow-async allow delayed initialization for more accurate container's width calculation
content-offset the offset from the edge of content to the edge of the container (default 0)

About

A library adding "native" scrolling behavior to any HTML element (textareas, divs, etc.)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published