mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 08:02:51 +02:00
include support for browserify
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
||||
.DS_Store
|
||||
/npm-debug.log
|
||||
/build
|
||||
/node_modules
|
||||
/node_modules
|
||||
/test/browserify/node_modules
|
||||
+2
-2
@@ -8,8 +8,8 @@ module.exports = function(grunt) {
|
||||
preserveComments: 'some'
|
||||
},
|
||||
build: {
|
||||
src: '<%= pkg.name %>.js',
|
||||
dest: 'build/<%= pkg.name %>.min.js'
|
||||
src: 'jquery.mousewheel.js',
|
||||
dest: 'build/jquery.mousewheel.min.js'
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
|
||||
+28
-1
@@ -22,7 +22,34 @@ $('#my_elem').mousewheel(function(event, delta, deltaX, deltaY) {
|
||||
```
|
||||
|
||||
## See it in action
|
||||
[See the tests on Github](http://brandonaaron.github.com/jquery-mousewheel/test) or navigate to `test/index.html` in your browser.
|
||||
[See the tests on Github](http://brandonaaron.github.com/jquery-mousewheel/test).
|
||||
|
||||
## Using with [Browserify](http://browserify.org)
|
||||
|
||||
Support for browserify is baked in.
|
||||
|
||||
```js
|
||||
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')($);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS style for Browserify
|
||||
module.exports = factory;
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
|
||||
+19
-1
@@ -1,6 +1,24 @@
|
||||
{
|
||||
"name" : "jquery.mousewheel",
|
||||
"name" : "jquery-mousewheel",
|
||||
"version": "3.1.1",
|
||||
"description" : "A jQuery plugin that adds cross-browser mouse wheel support.",
|
||||
"main" : "./jquery.mousewheel.js",
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/brandonaaron/jquery-mousewheel.git"
|
||||
},
|
||||
"keywords" : [ "jquery", "mouse", "wheel", "event", "mousewheel", "plugin", "browser" ],
|
||||
"author" : {
|
||||
"name" : "Brandon Aaron",
|
||||
"email" : "brandon.aaron@gmail.com",
|
||||
"url" : "http://brandonaaron.net/"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"grunt-contrib-jshint": "~0.2.0",
|
||||
"grunt-contrib-uglify": "~0.1.2",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# browserify test
|
||||
|
||||
First run
|
||||
|
||||
```js
|
||||
npm install jquery-browserify
|
||||
```
|
||||
|
||||
Then run
|
||||
|
||||
```js
|
||||
browserify main.js > bundle.js
|
||||
```
|
||||
|
||||
Then open index.html and console and scroll with the mousewheel. Should see the events being logged.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
<script src="bundle.js"></script>
|
||||
<script>
|
||||
$(document).bind('mousewheel', function(e) { console.log(e); });
|
||||
</script>
|
||||
@@ -0,0 +1,2 @@
|
||||
var $ = require('jquery-browserify');
|
||||
require('../../jquery.mousewheel.js')($);
|
||||
Reference in New Issue
Block a user