Files
librenms-librenms/README.md

68 lines
1.8 KiB
Markdown
Raw Normal View History

2008-10-15 20:35:05 -05:00
# jQuery Mouse Wheel Plugin
2013-11-13 13:33:53 -05:00
A [jQuery](http://jquery.com/) plugin that adds cross-browser mouse wheel support with delta normalization.
2008-10-15 20:35:05 -05:00
In order to use the plugin, simply bind the `mousewheel` event to an element.
2013-11-13 13:33:53 -05:00
It also provides two helper methods called `mousewheel` and `unmousewheel`
2013-11-13 13:33:53 -05:00
that act just like other event helper methods in jQuery.
The event object is updated with the normalized `deltaX` and `deltaY` properties.
In addition there is a new property on the event object called `deltaFactor`. Multiply
the `deltaFactor` by `deltaX` or `deltaY` to get the scroll distance that the browser
has reported.
2010-02-12 17:05:51 -06:00
Here is an example of using both the bind and helper method syntax:
2010-02-12 17:05:51 -06:00
```js
2013-11-13 13:33:53 -05:00
// using on
$('#my_elem').on('mousewheel', function(event) {
console.log(event.deltaX, event.deltaY, event.deltaFactor);
});
// using the event helper
2013-11-13 13:33:53 -05:00
$('#my_elem').mousewheel(function(event) {
console.log(event.deltaX, event.deltaY, event.deltaFactor);
});
```
2010-02-12 17:05:51 -06:00
2013-11-13 13:33:53 -05:00
The old behavior of adding three arguments (`delta`, `deltaX`, and `deltaY`) to the
event handler is now deprecated and will be removed in later releases.
## See it in action
[See the tests on Github](http://brandonaaron.github.io/jquery-mousewheel/test).
2013-03-12 09:21:08 -05:00
## Using with [Browserify](http://browserify.org)
Support for browserify is baked in.
```bash
2013-03-12 09:21:08 -05:00
npm install jquery-mousewheel
npm install jquery-browserify
```
In your server-side node.js code:
```js
var express = require('express');
var app = express.createServer();
app.use(require('browserify')({
require : [ 'jquery-browserify', 'jquery-mousewheel' ]
}));
```
In your browser-side javascript:
```js
var $ = require('jquery-browserify');
require('jquery-mousewheel')($);
```
2008-10-15 20:35:05 -05:00
## License
This plugin is licensed under the [MIT License](LICENSE.txt).
2008-10-15 20:35:05 -05:00
2013-10-18 18:52:17 -05:00
Copyright (c) 2013 [Brandon Aaron](http://brandon.aaron.sh)