rikschennink / scrollscreen

🌁 Custom styled vertical scrollbars

Home Page:https://rikschennink.github.io/scrollscreen/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scrollscreen

License: MIT npm version

Scrollscreen is a 1KB dependency free JavaScript library that positions a layer precisely on top of the browser default scrollbar in turn allowing custom styles.

Tested on IE11, Edge, Firefox, Chrome, Safari and iOS.

Live demo

Installation

Add CSS file to <head> and add JS file before end of <body>.

Usage

Put the scrollscreen CSS class on a container. Make sure the container's height is limited somehow so it's content overflows.

<style>
.scrollscreen--track {
    /* width of track, 18px covers native track on MacOS and Windows */
    width: 18px;
    background: #bebec1;
}

.scrollscreen--slider {
    /* use for spacing between slider and track */
    padding: .25em;
}

.scrollscreen--slider::after {
    /* the slider button style */
    background: #5f6165;
    border-radius: 9999em;
}
    
.scrollscreen {
    /* set scrollscreen to a fixed height to make scrollbars appear */
    height: 100px;
}
</style>
<div class="scrollscreen">
    <h1>Hi! I'm Scrollscreen!</h1>
    <p>Scrollscreen positions a layer precisely on top of the browser default scrollbar allowing custom styles.</p>
</div>

About

🌁 Custom styled vertical scrollbars

https://rikschennink.github.io/scrollscreen/

License:MIT License


Languages

Language:JavaScript 42.7%Language:HTML 39.2%Language:CSS 18.0%