Skip to content

Commit

Permalink
Optimized/fixed mouse-wheel scrolling on OSX, added version 3.1.13 mo…
Browse files Browse the repository at this point in the history
…usewheel plugin, removed year from license
  • Loading branch information
malihu committed Oct 27, 2015
1 parent 2c4c331 commit a848ef2
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Manos Malihutsakis, http://manos.malihu.gr
Copyright (c) Manos Malihutsakis, http://manos.malihu.gr

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 4 additions & 5 deletions jquery.mCustomScrollbar.concat.min.js

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions jquery.mCustomScrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ License: MIT License (MIT)
*/

/*
Copyright 2010 Manos Malihutsakis (email: manos@malihu.gr)
Copyright Manos Malihutsakis (email: manos@malihu.gr)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -47,7 +47,7 @@ and dependencies (minified).
var _rjs=typeof define==="function" && define.amd, /* RequireJS */
_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";
_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
if(!_rjs){
if(_njs){
require("jquery-mousewheel")($);
Expand Down Expand Up @@ -1466,7 +1466,8 @@ and dependencies (minified).
function _onMousewheel(e,delta){
_stop($this);
if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100;
var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
dur=o.scrollInertia;
if(o.axis==="x" || o.mouseWheel.axis==="x"){
var dir="x",
px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
Expand All @@ -1491,7 +1492,11 @@ and dependencies (minified).
e.stopImmediatePropagation();
e.preventDefault();
}
_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir});
if(e.deltaFactor<2 && !o.mouseWheel.normalizeDelta){
//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
amount=e.deltaFactor; dur=17;
}
_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
}
},
/* -------------------- */
Expand Down
5 changes: 2 additions & 3 deletions js/minified/jquery.mCustomScrollbar.min.js

Large diffs are not rendered by default.

Binary file modified js/minified/jquery.mCustomScrollbar.min.js.gz
Binary file not shown.
10 changes: 5 additions & 5 deletions js/minified/jquery.mousewheel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions js/uncompressed/jquery.mCustomScrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ License: MIT License (MIT)
*/

/*
Copyright 2010 Manos Malihutsakis (email: manos@malihu.gr)
Copyright Manos Malihutsakis (email: manos@malihu.gr)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -47,7 +47,7 @@ and dependencies (minified).
var _rjs=typeof define==="function" && define.amd, /* RequireJS */
_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";
_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
if(!_rjs){
if(_njs){
require("jquery-mousewheel")($);
Expand Down Expand Up @@ -1466,7 +1466,8 @@ and dependencies (minified).
function _onMousewheel(e,delta){
_stop($this);
if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100;
var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
dur=o.scrollInertia;
if(o.axis==="x" || o.mouseWheel.axis==="x"){
var dir="x",
px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
Expand All @@ -1491,7 +1492,11 @@ and dependencies (minified).
e.stopImmediatePropagation();
e.preventDefault();
}
_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir});
if(e.deltaFactor<2 && !o.mouseWheel.normalizeDelta){
//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
amount=e.deltaFactor; dur=17;
}
_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
}
},
/* -------------------- */
Expand Down
6 changes: 3 additions & 3 deletions js/uncompressed/jquery.mousewheel.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*!
* jQuery Mousewheel 3.1.12
* jQuery Mousewheel 3.1.13
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/

Expand Down

0 comments on commit a848ef2

Please sign in to comment.