GithubHelp home page GithubHelp logo

yowainwright / mousecase Goto Github PK

View Code? Open in Web Editor NEW
30.0 3.0 0.0 2.2 MB

A JavaScript utility enabling horizontal dragging on mousedown events šŸ–±

License: MIT License

TypeScript 100.00%
mouse trackpad scrollbar mouse-events mouse-tracking scrolling

mousecase's Introduction

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. šŸ’•

mousecase's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar renovate[bot] avatar yowainwright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mousecase's Issues

Horizontal Scroll Reference Materials

Requested Update

Reference Materials

Why Is This Update Needed?

Providing reference materials for options and ways to write horizontal scrolling features.

Read about references issues here. Provide paragraph text responses to each header.

Get test coverage up

Why Is This Update Needed?

Test coverage should be as close to 100% as possible.

Read about references issues here. Provide paragraph text responses to each header.

Optimize for Dom thrashing

Requested Update

Optimize for Dom thrashing

Why Is This Update Needed?

It will improve the "working" performance of MouseCase.

Are There Examples Of This Requested Update Elsewhere?

Must look!

Read about references issues here. Provide paragraph text responses to each header.

Action required: Greenkeeper could not be activated šŸšØ

šŸšØ You need to enable Continuous Integration on all branches of this repository. šŸšØ

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didnā€™t receive a CI status on the greenkeeper/initial branch, itā€™s possible that you donā€™t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how itā€™s configured. Make sure it is set to run on all new branches. If you donā€™t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, youā€™ll need to re-trigger Greenkeeperā€™s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper Appā€™s white list on Github. You'll find this list on your repo or organizationā€™s settings page, under Installed GitHub Apps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.