Horizontal scrolling plugin for smooth-scrollbar using modifier keys + mouse wheel.
- Customizable Modifier Key: Use Shift, Ctrl, Alt, or Cmd/Win + mouse wheel
- Momentum-based: Smooth scrolling experience
- Lightweight: Simple and focused functionality
Required: This plugin requires idiotWu/smooth-scrollbar to be loaded first.
Recommended (jsDelivr with version tag):
<script src="https://cdn.jsdelivr.net/gh/KnifeLemon/[email protected]/XAxisScrolling.js"></script>Alternative CDNs:
<!-- GitHub Raw -->
<script src="https://raw.githubusercontent.com/KnifeLemon/XAxisScrollPlugin-for-smooth-scrollbar/v1.0.0/XAxisScrolling.js"></script>
<!-- Statically -->
<script src="https://cdn.statically.io/gh/KnifeLemon/XAxisScrollPlugin-for-smooth-scrollbar/v1.0.0/XAxisScrolling.js"></script>Download XAxisScrolling.js and include it after smooth-scrollbar:
<script src="https://cdnjs.cloudflare.com/ajax/libs/smooth-scrollbar/8.8.4/smooth-scrollbar.min.js"></script>
<script src="./XAxisScrolling.js"></script>// Register plugin
Scrollbar.use(XAxisScrollPlugin);
// Method 1: Initialize all scrollbars with global options
Scrollbar.initAll({
plugins: {
xAxisScroll: {
modifierKey: 'shiftKey',
wheelSensitivity: 1.2
}
}
});
// Method 2: Initialize individual scrollbar
const scrollbar = Scrollbar.init(document.getElementById('container'), {
plugins: {
xAxisScroll: {
modifierKey: 'shiftKey',
wheelSensitivity: 1.2
}
}
});| Option | Type | Default | Description |
|---|---|---|---|
modifierKey |
string | 'shiftKey' |
Modifier key ('shiftKey', 'ctrlKey', 'altKey', 'metaKey') |
wheelSensitivity |
number | 1.2 |
Wheel sensitivity multiplier |
- Shift + Mouse Wheel: Horizontal scrolling (default)
- Ctrl + Mouse Wheel: Alternative modifier key
- Alt + Mouse Wheel: Alternative modifier key
- Cmd/Win + Mouse Wheel: Alternative modifier key
MIT