Skip to content

Commit e43f46b

Browse files
committed
updatin readme and license
1 parent b7c3589 commit e43f46b

File tree

4 files changed

+73
-41
lines changed

4 files changed

+73
-41
lines changed

ChangeLog.markdown

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Mouse Wheel ChangeLog
22

3-
43
# 3.0.2
54

65
* Fixed delta being opposite value in latest Opera

LICENSE.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2010, Brandon Aaron (http://brandonaaron.net/)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.markdown

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22

33
A jQuery plugin that adds cross-browser mouse wheel support.
44

5-
The latest stable release can be downloaded from the [project page](http://plugins.jquery.com/project/mousewheel)
5+
In order to use the plugin, simply bind the "mousewheel" event to an element. It also provides two helper methods called `mousewheel` and `unmousewheel` that act just like other event helper methods in jQuery. The event callback receives an extra argument which is the normalized "delta" of the mouse wheel.
6+
7+
Here is an example of using both the bind and helper method syntax.
8+
9+
// using bind
10+
$('#my_elem').bind('mousewheel', function(event, delta) {
11+
console.log(delta);
12+
});
13+
14+
// using the event helper
15+
$('#my_elem').mousewheel(function(event, delta) {
16+
console.log(delta);
17+
});
18+
619

720
## License
821

9-
The mousewheel plugin is dual licensed *(just like jQuery)* under the [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL](http://www.opensource.org/licenses/gpl-license.php) licenses.
22+
The expandable plugin is licensed under the MIT License (LICENSE.txt).
1023

1124
Copyright (c) 2009 [Brandon Aaron](http://brandonaaron.net)

jquery.mousewheel.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
2-
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3-
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
1+
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
2+
* Licensed under the MIT License (LICENSE.txt).
3+
*
44
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
55
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
66
*
7-
* Version: 3.0.2
7+
* Version: 3.0.3-pre
88
*
99
* Requires: 1.2.2+
1010
*/
@@ -14,47 +14,47 @@
1414
var types = ['DOMMouseScroll', 'mousewheel'];
1515

1616
$.event.special.mousewheel = {
17-
setup: function() {
18-
if ( this.addEventListener )
19-
for ( var i=types.length; i; )
20-
this.addEventListener( types[--i], handler, false );
21-
else
22-
this.onmousewheel = handler;
23-
},
24-
25-
teardown: function() {
26-
if ( this.removeEventListener )
27-
for ( var i=types.length; i; )
28-
this.removeEventListener( types[--i], handler, false );
29-
else
30-
this.onmousewheel = null;
31-
}
17+
setup: function() {
18+
if ( this.addEventListener )
19+
for ( var i=types.length; i; )
20+
this.addEventListener( types[--i], handler, false );
21+
else
22+
this.onmousewheel = handler;
23+
},
24+
25+
teardown: function() {
26+
if ( this.removeEventListener )
27+
for ( var i=types.length; i; )
28+
this.removeEventListener( types[--i], handler, false );
29+
else
30+
this.onmousewheel = null;
31+
}
3232
};
3333

3434
$.fn.extend({
35-
mousewheel: function(fn) {
36-
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
37-
},
38-
39-
unmousewheel: function(fn) {
40-
return this.unbind("mousewheel", fn);
41-
}
35+
mousewheel: function(fn) {
36+
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
37+
},
38+
39+
unmousewheel: function(fn) {
40+
return this.unbind("mousewheel", fn);
41+
}
4242
});
4343

4444

4545
function handler(event) {
46-
var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
47-
48-
event = $.event.fix(event || window.event);
49-
event.type = "mousewheel";
50-
51-
if ( event.wheelDelta ) delta = event.wheelDelta/120;
52-
if ( event.detail ) delta = -event.detail/3;
53-
54-
// Add events and delta to the front of the arguments
55-
args.unshift(event, delta);
56-
57-
return $.event.handle.apply(this, args);
46+
var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
47+
48+
event = $.event.fix(event || window.event);
49+
event.type = "mousewheel";
50+
51+
if ( event.wheelDelta ) delta = event.wheelDelta/120;
52+
if ( event.detail ) delta = -event.detail/3;
53+
54+
// Add event and delta to the front of the arguments
55+
args.unshift(event, delta);
56+
57+
return $.event.handle.apply(this, args);
5858
}
5959

6060
})(jQuery);

0 commit comments

Comments
 (0)