Skip to content

KnifeLemon/XAxisScrollPlugin-for-smooth-scrollbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

X-Axis Scroll Plugin

Horizontal scrolling plugin for smooth-scrollbar using modifier keys + mouse wheel.

Features

  • Customizable Modifier Key: Use Shift, Ctrl, Alt, or Cmd/Win + mouse wheel
  • Momentum-based: Smooth scrolling experience
  • Lightweight: Simple and focused functionality

Installation

Required: This plugin requires idiotWu/smooth-scrollbar to be loaded first.

CDN

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>

Manual Download

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>

Usage

// 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
        }
    }
});

Options

Option Type Default Description
modifierKey string 'shiftKey' Modifier key ('shiftKey', 'ctrlKey', 'altKey', 'metaKey')
wheelSensitivity number 1.2 Wheel sensitivity multiplier

Controls

  • 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

License

MIT

About

Horizontal scrolling plugin for smooth-scrollbar using modifier keys + mouse wheel.

Resources

License

Stars

Watchers

Forks

Packages

No packages published