@ne1410s/scrollr
v0.1.293
Published
A scroll viewer.
Readme
@ne1410s/scrollr
Customisable & lightweight scrollbars.
<ne14-scrollr>
<span>Hello world</span>
</ne14-scrollr>- Use:
<script src="PATH_TO_UMD_SCRIPT"></script> - Extend: npm i -S @ne1410s/scrollr
Attributes
- There are no bespoke attributes exposed in this element
Events
- There are no bespoke events raised by this element
Methods
As well as specifying the element directly in HTML, it is also possible to wrap an element with scrollbars dynamically:
window.ne_scrollr.apply('#existing-element', 'new-class-name');- [Module].apply(selector, (newClass))
-- selector: CSS selector of element to wrap
-- newClass: Class to add to wrapper; e.g. to help deliver different styles to different scrollrs
Properties
- There are no bespoke properties exposed in this element
CSS Variables
A reasonable amount of custom styling can be provided, by way of css variables:
ne14-scrollr {
--max-width: 300px;
--max-height: 200px;
}--backgroundBackground for the scroll area. Not normally necessary; the background of the wrapped content should work in most cases--colorColor for the draggable bars. Defaults to:rgb(193, 193, 193)--cursorCursor for the draggable bars--cursor-xCursor override for the horizontal bar--cursor-yCursor override for the vertical bar--marginSeparation between bar and side (only when inactive)--max-widthMaximum width of the scroll area. Defaults to:100%--max-heightMaximum height of the scroll area. Defaults to:600px--min-lengthMinimum bar length. Defaults to:30px--outlineOutline for the bar--radiusBorder radius for the bar--shadowShadow for the bar--thicknessThickness of the bar. Defaults to:3px--track-colorColor for the track behind the bar--track-cursorCursor for the track behind the bar--transition-durationDuration for several tranistions. Defaults to:0.2s--active-colorColor for the bar (when active). Defaults to:rgb(168, 168, 168)--active-outlineOutline for the bar (when active)--active-radiusBorder radius for the bar (when active)--active-shadowBox shadow for the bar (when active)--active-thicknessThickness of the bar (when active). Defaults to:10px--active-track-colorColor for the track behind the bar (when active). Defaults to:rgba(241, 241, 241, 0.3)
*The active state of the bar is triggered on hover
