GitXplorerGitXplorer
y

mousecase

public
29 stars
0 forks
4 issues

Commits

List of commits on branch master.
Verified
b98d2fa366f217d7c354cd3cd041a883b477aa56

Build(deps-dev): bump vite from 4.5.2 to 4.5.3 (#516)

ddependabot[bot] committed 9 months ago
Verified
e8fbb3297471dca4e9e6f6783316a90facd308da

Build(deps-dev): bump typescript from 5.3.2 to 5.4.3 (#513)

ddependabot[bot] committed 10 months ago
Verified
adfc7d9d060cae4c6ccbafcc672d7ab6660ccb5a

Build(deps-dev): bump rollup from 3.28.0 to 3.29.4 (#506)

ddependabot[bot] committed a year ago
Verified
ca94d78ea6c011e876089ffd888d4b53b928727b

Build(deps-dev): bump vitest from 0.34.2 to 1.3.1 (#509)

ddependabot[bot] committed a year ago
Verified
98d10419f7e438b2219c5b7deaf0fefc46fd2dc7

Build(deps-dev): bump eslint-config-prettier from 8.9.0 to 9.0.0 (#501)

ddependabot[bot] committed a year ago
Verified
88218da5df4ff59cd68841f042c855f99b929ba2

Build(deps-dev): bump vite from 4.4.2 to 4.5.2 (#504)

ddependabot[bot] committed a year ago

README

The README file for this repository.

MouseCase

Mousecase 🖱

Typed with TypeScript npm version

Mousecase is a JavaScript utility supporting touch-like horizontal scrolling with a mouse! It is a no-nonsense, 0 dependency JavaScript plugin that solves 1 use case:

Scrolling a horizontal browser window plain with a mouse without using a scrollbar.

Synopsis

Being able to horizontally scroll is a default behavior on phones and with trackpads. With Mousecase, the archaic computer mouse pad can keep up! Yay. Users can click down on their computer mouse pad and drag scrollable horizontal browser window content without a scrollbar. This utility can help remove the need to implement a slider or carousel thingy. Therefore, it basically saves lives!

Setup

Install it!

yarn mousecase -D

Use it!

import mouseCase from 'mousecase'

const mousecase = mouseCase('some-selector')
mousecase.init()

That's it! Are you happier now that your customer can scroll horizontal web browser interfaces with a mouse pad just like they are on their phone? I hope so. If not, I'm not a shrink so I can't help you but I empathize—life's tough.

API

Listed below is the small API that Mousecase provides to use it.

MouseCase

MouseCase itself is a factory that takes in 2 arguments.

Arguments

target an string or node that is selected to use mousecase; is required

ex: mouseCase('some-target')

options: {object} containing plugin config

ex: mouseCase('some-target', { cssClass: 'mousecase-fun' })

  • activeClass the css class added to the mousecase target element when mousecase is active

  • cssClass: the css class added to the mousecase target element

  • el the formatted target element

  • rule: a boolean rule that defines whether mousecase should run (or not)

  • all props are added as defaults if not provided during setup

Methods

init() initiates mousecase (setup).

ex: someMouseCaseInstance.init()

on() turns mousecase back on (after initiation)

ex: someMouseCaseInstance.on()

off() turns mousecase off (after initiation)

ex: someMouseCaseInstance.off()

  • There are other methods used within Mousecase but not intended for general use

Demos

Listed below is a basic Mousecase demo. Feel free to share more.

  • Bill Murray CodePen
  • Please submit a PR with your demo here. 💕