Skip to content

el-schneider/alpine-mousedrag-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alpine Mouse Drag Plugin

An Alpine.js plugin that adds a x-mousedrag directive for mouse drag scrolling with inertia. The plugin allows you to easily add drag-to-scroll functionality to any scrollable element.

Installation

Install the package via npm:

npm install alpine-mousedrag-plugin

Or via yarn:

yarn add alpine-mousedrag-plugin

Usage

First, import and initialize the plugin:

import Alpine from "alpinejs";
import AlpineMouseDragPlugin from "alpine-mousedrag-plugin";

Alpine.plugin(AlpineMouseDragPlugin);
Alpine.start();

Then, add the x-mousedrag directive to any scrollable element:

<div x-data x-mousedrag class="scrollable-element">
  <!-- Your scrollable content here -->
</div>

Modifiers

  • disableinertia: Use this modifier to disable the inertia effect.
<div x-data x-mousedrag.disableinertia class="scrollable-element">
  <!-- Your scrollable content here -->
</div>

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published