Skip to content

Commit 479b831

Browse files
committed
include support for browserify
1 parent 77551b1 commit 479b831

File tree

9 files changed

+9536
-5
lines changed

9 files changed

+9536
-5
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
12
/npm-debug.log
23
/build
3-
/node_modules
4+
/node_modules
5+
/test/browserify/node_modules

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module.exports = function(grunt) {
88
preserveComments: 'some'
99
},
1010
build: {
11-
src: '<%= pkg.name %>.js',
12-
dest: 'build/<%= pkg.name %>.min.js'
11+
src: 'jquery.mousewheel.js',
12+
dest: 'build/jquery.mousewheel.min.js'
1313
}
1414
},
1515
jshint: {

README.markdown

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,34 @@ $('#my_elem').mousewheel(function(event, delta, deltaX, deltaY) {
2222
```
2323

2424
## See it in action
25-
[See the tests on Github](http://brandonaaron.github.com/jquery-mousewheel/test) or navigate to `test/index.html` in your browser.
25+
[See the tests on Github](http://brandonaaron.github.com/jquery-mousewheel/test).
26+
27+
## Using with [Browserify](http://browserify.org)
28+
29+
Support for browserify is baked in.
30+
31+
```js
32+
npm install jquery-mousewheel
33+
npm install jquery-browserify
34+
```
35+
36+
In your server-side node.js code:
37+
38+
```js
39+
var express = require('express');
40+
var app = express.createServer();
41+
42+
app.use(require('browserify')({
43+
require : [ 'jquery-browserify', 'jquery-mousewheel' ]
44+
}));
45+
```
46+
47+
In your browser-side javascript:
48+
49+
```js
50+
var $ = require('jquery-browserify');
51+
require('jquery-mousewheel')($);
52+
```
2653

2754
## License
2855

jquery.mousewheel.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
if ( typeof define === 'function' && define.amd ) {
1515
// AMD. Register as an anonymous module.
1616
define(['jquery'], factory);
17+
} else if (typeof exports === 'object') {
18+
// Node/CommonJS style for Browserify
19+
module.exports = factory;
1720
} else {
1821
// Browser globals
1922
factory(jQuery);

package.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
{
2-
"name" : "jquery.mousewheel",
2+
"name" : "jquery-mousewheel",
33
"version": "3.1.1",
4+
"description" : "A jQuery plugin that adds cross-browser mouse wheel support.",
5+
"main" : "./jquery.mousewheel.js",
6+
"repository" : {
7+
"type" : "git",
8+
"url" : "https://github.com/brandonaaron/jquery-mousewheel.git"
9+
},
10+
"keywords" : [ "jquery", "mouse", "wheel", "event", "mousewheel", "plugin", "browser" ],
11+
"author" : {
12+
"name" : "Brandon Aaron",
13+
"email" : "[email protected]",
14+
"url" : "http://brandonaaron.net/"
15+
},
16+
"licenses": [
17+
{
18+
"type": "MIT",
19+
"url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
20+
}
21+
],
422
"devDependencies": {
523
"grunt-contrib-jshint": "~0.2.0",
624
"grunt-contrib-uglify": "~0.1.2",

test/browserify/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# browserify test
2+
3+
First run
4+
5+
```js
6+
npm install jquery-browserify
7+
```
8+
9+
Then run
10+
11+
```js
12+
browserify main.js > bundle.js
13+
```
14+
15+
Then open index.html and console and scroll with the mousewheel. Should see the events being logged.

0 commit comments

Comments
 (0)