GithubHelp home page GithubHelp logo

villanus / jquery.accel-hover-scroll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from machty/jquery.accel-hover-scroll

0.0 2.0 0.0 105 KB

Horizontal, accelerating hover-scroll plugin for jQuery

jquery.accel-hover-scroll's Introduction

Accelerated Hover Scroll

Use this jQuery plugin to create horizontal, hover, accelerated scrolling panels.

Accelerated?

When you hover your mouse toward the edge of the container, it'll scroll in that direction. The closer you are to the edge, the faster it scrolls. This is by no means a new UI interaction, but I couldn't find a suitable plugin for my needs, so I built this one.

Please let me know if there's a more concise way to describe this interaction. jquery.accel-hover-scroll doesn't exactly roll off the tongue.

What kind of containers does it support?

This plugin supports all the typical means of horizontally lining up content, including floating, inline-block + white-space nowrap, etc.

CSS3?

The code's built to use jQuery.fn.animate, and plays nicely with jquery.animate-enhanced, though depending on what you're actually displaying and a million other factors, the timer-based animate might actually serve you better, so be sure to A/B test.

Demo

http://jsfiddle.net/machty/qsbBc/

There's also a questionably-informative blog post about the plugin that you can read.

Options

This plugin supports a variety of options to customize scroller.

// Default settings

// The scroll speed right at the edge of the
// container, pixels per second
maxScrollSpeed: 800,

// Percentage of the container's width that'll
// be hover-scrollable. Choose a small value if
// you'd like a wider center region where no
// scrolling occurs.
scrollGutterPercentage: 0.3,

// You probably won't need to change this, but
// internally, the scroll speed is determined
// according to which 'slice' of the gutter the
// cursor falls in. In other words, there isn't
// a perfect smooth gradient from slow to fast, but
// rather small slices that you probably won't notice
// or need to change. It's sliced this way for efficiency
// purposes; this plugin utilizes jQuery.fn.animate for
// its scrolling, and constantly changing the speed of the
// scroll based on single pixel changes in the mouse location
// can lead to some choppiness, particularly if there
// are images involved, or if you're using the 
// CSS3 transition-enabled jQuery.animation-enhanced
// plugin
scrollGutterSlices: 5,

// Control whether cursor changes to left/right
// arrows when hover-scrolling.
overrideCursor: true

Methods

The hover-scroll functionality can be temporarily disabled via the pause and resume methods, e.g.:

$('.hoverscroll').accelHoverScroll({ /* init options */ });
$('.hoverscroll').accelHoverScroll("pause");
$('.hoverscroll').accelHoverScroll("resume");

TODO

  • Tests
  • Vertical Support
  • Destructor
  • Documentation

Credits / Contribution

Built by Alex Matchneer on behalf of the Useful Robot

Feel free to contribute to this plugin via the normal pull request fanfare.

jquery.accel-hover-scroll's People

Contributors

machty avatar

Watchers

 avatar  avatar

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.