0.0.18 • Published 2 years ago

@xlibz/scrollbar v0.0.18

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

scrollbar

A library for creating a custom scrollbar

Usage Example

  <body>
    <x-scrollbar>
      <scrollbar-knob>
    </x-scrollbar>
    <div class="content"></div>
  </body>
html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden auto;
}

body {
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

x-scrollbar {
  position: fixed;
  top: 0;
  right: 0;
  width: 1vmin;
  height: 100%;
  background-color: #ebebeb;
}

scrollbar-knob {
  background-color: black;
}

.content {
  height: 500vh;
  width: 100%;
}

Recipes

  • if the width of the scrollbar is greater than the height, the knob will move horizontally.

  • You can create a scrollbar for any element that has overflow, but the position: fixed used in the above example may not be suitable for all cases. If things don't work as expected, try different options for the position.

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.8

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago