瀏覽代碼

3.6.7 - some fixes

Changed features
- optimized debounced function using requestAnimationFrame
- optimized lazyResize

Fixes
- Horizontal RTL mode support #508
- Horizontal mousewheel scroll (shift + scroll) not working properly
#547
- jQueryUI draggable scroll Invalid ? #530
- Fix error when using mm.foundation.modal #550
- fix docscroll undefined of null by #557
InuYaksa 9 年之前
父節點
當前提交
7d68f8ac4b
共有 9 個文件被更改,包括 307 次插入490 次删除
  1. 3 1
      README.md
  2. 0 46
      changelog_3.6.6.txt
  3. 28 0
      changelog_3.6.7.txt
  4. 0 119
      demo/js/jquery.nicescroll.min.js
  5. 92 0
      demo/rtlmode/horizontal.html
  6. 0 119
      dist/jquery.nicescroll.min.js
  7. 174 84
      jquery.nicescroll.js
  8. 0 119
      jquery.nicescroll.min.js
  9. 10 2
      package.json

+ 3 - 1
README.md

@@ -1,10 +1,12 @@
 #jQuery.NiceScroll
 #jQuery.NiceScroll
-v. 3.6.6 11-17-2015
+v. 3.6.6 02-08-2016
 
 
  - [Web Site: nicescroll.areaaperta.com](http://nicescroll.areaaperta.com)
  - [Web Site: nicescroll.areaaperta.com](http://nicescroll.areaaperta.com)
  - [Repo: github.com/inuyaksa/jquery.nicescroll](https://github.com/inuyaksa/jquery.nicescroll)
  - [Repo: github.com/inuyaksa/jquery.nicescroll](https://github.com/inuyaksa/jquery.nicescroll)
  - [Twitter: @nicescroll](https://twitter.com/nicescroll)
  - [Twitter: @nicescroll](https://twitter.com/nicescroll)
 
 
+ [![Join the chat at https://gitter.im/inuyaksa/jquery.nicescroll](https://badges.gitter.im/inuyaksa/jquery.nicescroll.svg)](https://gitter.im/inuyaksa/jquery.nicescroll?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
 > Nicescroll as a Greasemonkey plugin: http://userscripts.org/scripts/show/119910 (freezed)
 > Nicescroll as a Greasemonkey plugin: http://userscripts.org/scripts/show/119910 (freezed)
 
 
 
 

+ 0 - 46
changelog_3.6.6.txt

@@ -1,46 +0,0 @@
-Changelog nicescroll release 3.6.6
-http://nicescroll.areaaperta.com/
-https://github.com/inuyaksa/jquery.nicescroll
-
-
-New options
-none
-
-Changed features
-none
-
-Fixes
-- allow horizrailenabled false and timeout issue #479
-- allow left rail offset for left aligned scroll bars #483 
-- Fixed issue of shifting cursor in textarea #507
-- Angular added #510 
-- Remove moot `version` property from bower.json #517
-- Background Parallax Fix #518
-- Browserify and Node/CommonJS support. #534
-- Reset checkarea for mouse wheel event when the mouse moved #537
-- Fixing nicescroll visibility inside Modal #544
-- nice scroll version 3.6.0 mouse wheel not working on safari 5.1.7 #490 
-- Cannot assign to read only property 'scrollable' of false on Chrome when horizrailenabled flase #461 
-- delaylist null error on hidding element #260
-- horizrailenabled: false is broken #523 
- 
-
-Thanks to great contributors!!
-
-babadofar
-hrfuller
-arzafran
-tushariscoolster
-kkirsche
-duckzland
-bnadeau
-abhi05b
-krishnareddy668
-creativform
-PlippiePlop
-abou7mied
-
-
-
-TODO
-- deprecate legacy browsers

+ 28 - 0
changelog_3.6.7.txt

@@ -0,0 +1,28 @@
+Changelog nicescroll release 3.6.7
+http://nicescroll.areaaperta.com/
+https://github.com/inuyaksa/jquery.nicescroll
+
+
+New options
+none
+
+Changed features
+- optimized debounced function using requestAnimationFrame
+- optimized lazyResize
+
+Fixes
+- Horizontal RTL mode support #508 
+- Horizontal mousewheel scroll (shift + scroll) not working properly #547 
+- jQueryUI draggable scroll Invalid ? #530 
+- Fix error when using mm.foundation.modal #550 
+- fix docscroll undefined of null by #557
+ 
+
+Thanks to great contributors!!
+
+hakatashi
+kris-2k15
+
+
+TODO
+- deprecate legacy browsers

文件差異過大導致無法顯示
+ 0 - 119
demo/js/jquery.nicescroll.min.js


+ 92 - 0
demo/rtlmode/horizontal.html

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title></title>
+		<meta charset="utf-8">
+		<style>
+			.nice {
+				width: 200px;
+				height: 200px;
+				margin: 50px;
+				background: salmon;
+			}
+
+			.nice p {
+				width: 1000px;
+			}
+
+			.vertical-rl {
+				writing-mode: tb-rl;
+				writing-mode: vertical-rl;
+				-ms-writing-mode: vertical-rl;
+				-moz-writing-mode: vertical-rl;
+				-webkit-writing-mode: vertical-rl;
+			}
+
+			.vertical-lr {
+				writing-mode: tb-lr;
+				writing-mode: vertical-lr;
+				-ms-writing-mode: vertical-lr;
+				-moz-writing-mode: vertical-lr;
+				-webkit-writing-mode: vertical-lr;
+			}
+		</style>
+		<script src="../js/jquery.min.js"></script>
+		<script src="../../jquery.nicescroll.js"></script>
+		<script>
+			$(document).ready(function() {
+				$(".nice").niceScroll();
+			});
+		</script>
+	</head>
+	<body>
+		<h3>RTL horizontal</h3>
+		<div dir="rtl" class="dir-rtl nice">
+			<p>
+				هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن التركيز على الشكل الخارجي للنص أو شكل توضع الفقرات في الصفحة التي يقرأها. ولذلك يتم استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن استخدام "هنا يوجد محتوى نصي، هنا يوجد محتوى نصي" فتجعلها تبدو (أي الأحرف) وكأنها نص مقروء. العديد من برامح النشر المكتبي وبرامح تحرير صفحات الويب تستخدم لوريم إيبسوم بشكل إفتراضي كنموذج عن النص، وإذا قمت بإدخال "lorem ipsum" في أي محرك بحث ستظهر العديد من المواقع الحديثة العهد في نتائج البحث. على مدى السنين ظهرت نسخ جديدة ومختلفة من نص لوريم إيبسوم، أحياناً عن طريق الصدفة، وأحياناً عن عمد كإدخال بعض العبارات الفكاهية إليها.
+			</p>
+		</div>
+		<h3>RTL vertical</h3>
+		<div class="vertical-rl nice">
+			<p>
+				「天は人の上に人を造らず人の下に人を造らず」と言えり。
+				されば天より人を生ずるには、万人は万人みな同じ位にして、生まれながら貴賤上下の差別なく、
+				万物の霊たる身と心との働きをもって天地の間にあるよろずの物を資り、もって衣食住の用を達し、
+				自由自在、互いに人の妨げをなさずしておのおの安楽にこの世を渡らしめ給うの趣意なり。
+				されども今、広くこの人間世界を見渡すに、かしこき人あり、おろかなる人あり、貧しきもあり、
+				富めるもあり、貴人もあり、下人もありて、その有様雲と泥との相違あるに似たるはなんぞや。
+				その次第はなはだ明らかなり。『実語教』に、「人学ばざれば智なし、智なき者は愚人なり」とあり。
+				されば賢人と愚人との別は学ぶと学ばざるとによりてできるものなり。
+				また世の中にむずかしき仕事もあり、やすき仕事もあり。
+				そのむずかしき仕事をする者を身分重き人と名づけ、やすき仕事をする者を身分軽き人という。
+				すべて心を用い、心配する仕事はむずかしくして、手足を用うる力役はやすし。
+				ゆえに医者、学者、政府の役人、または大なる商売をする町人、
+				あまたの奉公人を召し使う大百姓などは、身分重くして貴き者と言うべし。
+			</p>
+		</div>
+		<h3>LTR horizontal</h3>
+		<div dir="ltr" class="dir-ltr nice">
+			<p>
+				هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن التركيز على الشكل الخارجي للنص أو شكل توضع الفقرات في الصفحة التي يقرأها. ولذلك يتم استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن استخدام "هنا يوجد محتوى نصي، هنا يوجد محتوى نصي" فتجعلها تبدو (أي الأحرف) وكأنها نص مقروء. العديد من برامح النشر المكتبي وبرامح تحرير صفحات الويب تستخدم لوريم إيبسوم بشكل إفتراضي كنموذج عن النص، وإذا قمت بإدخال "lorem ipsum" في أي محرك بحث ستظهر العديد من المواقع الحديثة العهد في نتائج البحث. على مدى السنين ظهرت نسخ جديدة ومختلفة من نص لوريم إيبسوم، أحياناً عن طريق الصدفة، وأحياناً عن عمد كإدخال بعض العبارات الفكاهية إليها.
+			</p>
+		</div>
+		<h3>LTR vertical</h3>
+		<div class="vertical-lr nice">
+			<p>
+				「天は人の上に人を造らず人の下に人を造らず」と言えり。
+				されば天より人を生ずるには、万人は万人みな同じ位にして、生まれながら貴賤上下の差別なく、
+				万物の霊たる身と心との働きをもって天地の間にあるよろずの物を資り、もって衣食住の用を達し、
+				自由自在、互いに人の妨げをなさずしておのおの安楽にこの世を渡らしめ給うの趣意なり。
+				されども今、広くこの人間世界を見渡すに、かしこき人あり、おろかなる人あり、貧しきもあり、
+				富めるもあり、貴人もあり、下人もありて、その有様雲と泥との相違あるに似たるはなんぞや。
+				その次第はなはだ明らかなり。『実語教』に、「人学ばざれば智なし、智なき者は愚人なり」とあり。
+				されば賢人と愚人との別は学ぶと学ばざるとによりてできるものなり。
+				また世の中にむずかしき仕事もあり、やすき仕事もあり。
+				そのむずかしき仕事をする者を身分重き人と名づけ、やすき仕事をする者を身分軽き人という。
+				すべて心を用い、心配する仕事はむずかしくして、手足を用うる力役はやすし。
+				ゆえに医者、学者、政府の役人、または大なる商売をする町人、
+				あまたの奉公人を召し使う大百姓などは、身分重くして貴き者と言うべし。
+			</p>
+		</div>
+	</body>
+</html>

文件差異過大導致無法顯示
+ 0 - 119
dist/jquery.nicescroll.min.js


+ 174 - 84
jquery.nicescroll.js

@@ -1,6 +1,6 @@
 /* jquery.nicescroll
 /* jquery.nicescroll
--- version 3.6.6
--- copyright 2015-11-17 InuYaksa*2015
+-- version 3.6.7
+-- copyright 2016-02-08 InuYaksa*2016
 -- licensed under the MIT
 -- licensed under the MIT
 --
 --
 -- http://nicescroll.areaaperta.com/
 -- http://nicescroll.areaaperta.com/
@@ -46,8 +46,11 @@
   if (!setAnimationFrame) {  // legacy detection
   if (!setAnimationFrame) {  // legacy detection
     for (var vx in vendors) {
     for (var vx in vendors) {
       var v = vendors[vx];
       var v = vendors[vx];
-      if (!setAnimationFrame) setAnimationFrame = window[v + 'RequestAnimationFrame'];
-      if (!clearAnimationFrame) clearAnimationFrame = window[v + 'CancelAnimationFrame'] || window[v + 'CancelRequestAnimationFrame'];
+      setAnimationFrame = window[v + 'RequestAnimationFrame'];
+      if (setAnimationFrame) {
+        clearAnimationFrame = window[v + 'CancelAnimationFrame'] || window[v + 'CancelRequestAnimationFrame'];
+        break;
+      }
     }
     }
   }
   }
 
 
@@ -58,7 +61,7 @@
     cursoropacitymin: 0,
     cursoropacitymin: 0,
     cursoropacitymax: 1,
     cursoropacitymax: 1,
     cursorcolor: "#424242",
     cursorcolor: "#424242",
-    cursorwidth: "5px",
+    cursorwidth: "6px",
     cursorborder: "1px solid #fff",
     cursorborder: "1px solid #fff",
     cursorborderradius: "5px",
     cursorborderradius: "5px",
     scrollspeed: 60,
     scrollspeed: 60,
@@ -133,10 +136,10 @@
     d.isieold = (d.isie && !("msInterpolationMode" in _style)); // IE6 and older
     d.isieold = (d.isie && !("msInterpolationMode" in _style)); // IE6 and older
     d.isie7 = d.isie && !d.isieold && (!("documentMode" in document) || (document.documentMode == 7));
     d.isie7 = d.isie && !d.isieold && (!("documentMode" in document) || (document.documentMode == 7));
     d.isie8 = d.isie && ("documentMode" in document) && (document.documentMode == 8);
     d.isie8 = d.isie && ("documentMode" in document) && (document.documentMode == 8);
-    d.isie9 = d.isie && ("performance" in window) && (document.documentMode >= 9);
+    d.isie9 = d.isie && ("performance" in window) && (document.documentMode == 9);
     d.isie10 = d.isie && ("performance" in window) && (document.documentMode == 10);
     d.isie10 = d.isie && ("performance" in window) && (document.documentMode == 10);
     d.isie11 = ("msRequestFullscreen" in _el) && (document.documentMode >= 11); // IE11+
     d.isie11 = ("msRequestFullscreen" in _el) && (document.documentMode >= 11); // IE11+
-		d.isieedge = (navigator.userAgent.match(/Edge\/12\./));
+    d.isieedge = (navigator.userAgent.match(/Edge\/12\./));  // IE Edge 12
 
 
     d.isie9mobile = /iemobile.9/i.test(_agent); //wp 7.1 mango
     d.isie9mobile = /iemobile.9/i.test(_agent); //wp 7.1 mango
     if (d.isie9mobile) d.isie9 = false;
     if (d.isie9mobile) d.isie9 = false;
@@ -147,18 +150,20 @@
     d.iswebkit = ("WebkitAppearance" in _style);
     d.iswebkit = ("WebkitAppearance" in _style);
 
 
     d.ischrome = ("chrome" in window);
     d.ischrome = ("chrome" in window);
-    d.ischrome22 = (d.ischrome && d.haspointerlock);
-    d.ischrome26 = (d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix)
-
-    d.cantouch = ("ontouchstart" in document.documentElement) || ("ontouchstart" in window); // detection for Chrome Touch Emulation
-    d.hasmstouch = (window.MSPointerEvent || false); // IE10 pointer events
+    d.ischrome38 = (d.ischrome && ("touchAction" in _style)); // behavior changed in touch emulation    
+    d.ischrome22 = (!d.ischrome38)&&(d.ischrome && d.haspointerlock);
+    d.ischrome26 = (!d.ischrome38)&&(d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix)
+    
+    d.cantouch = ("ontouchstart" in document.documentElement) || ("ontouchstart" in window); // with detection for Chrome Touch Emulation    
     d.hasw3ctouch = (window.PointerEvent || false) && ((navigator.MaxTouchPoints > 0)||(navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec
     d.hasw3ctouch = (window.PointerEvent || false) && ((navigator.MaxTouchPoints > 0)||(navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec
+    d.hasmstouch = (!d.hasw3ctouch)&&(window.MSPointerEvent || false); // IE10 pointer events
 
 
     d.ismac = /^mac$/i.test(_platform);
     d.ismac = /^mac$/i.test(_platform);
-
+    
     d.isios = (d.cantouch && /iphone|ipad|ipod/i.test(_platform));
     d.isios = (d.cantouch && /iphone|ipad|ipod/i.test(_platform));
     d.isios4 = ((d.isios) && !("seal" in Object));
     d.isios4 = ((d.isios) && !("seal" in Object));
     d.isios7 = ((d.isios)&&("webkitHidden" in document));  //iOS 7+
     d.isios7 = ((d.isios)&&("webkitHidden" in document));  //iOS 7+
+    d.isios8 = ((d.isios)&&("hidden" in document));  //iOS 8+
 
 
     d.isandroid = (/android/i.test(_agent));
     d.isandroid = (/android/i.test(_agent));
 
 
@@ -206,14 +211,14 @@
     d.hastransition = (d.transitionstyle);
     d.hastransition = (d.transitionstyle);
 
 
     function detectCursorGrab() {
     function detectCursorGrab() {
-      var lst = ['-webkit-grab', '-moz-grab', 'grab'];
-      if ((d.ischrome && !d.ischrome22) || d.isie) lst = []; // force setting for IE returns false positive and chrome cursor bug
+      var lst = ['grab','-webkit-grab', '-moz-grab'];
+      if ((d.ischrome && !d.ischrome38) || d.isie) lst = []; // force setting for IE returns false positive and chrome cursor bug
       for (var a = 0; a < lst.length; a++) {
       for (var a = 0; a < lst.length; a++) {
         var p = lst[a];
         var p = lst[a];
         _style.cursor = p;
         _style.cursor = p;
         if (_style.cursor == p) return p;
         if (_style.cursor == p) return p;
       }
       }
-      return 'url(//mail.google.com/mail/images/2/openhand.cur),n-resize'; // thank you google for custom cursor!
+      return 'url(//patriciaportfolio.googlecode.com/files/openhand.cur),n-resize'; // thank you google for custom cursor!
     }
     }
     d.cursorgrabvalue = detectCursorGrab();
     d.cursorgrabvalue = detectCursorGrab();
 
 
@@ -232,7 +237,7 @@
 
 
     var self = this;
     var self = this;
 
 
-    this.version = '3.6.6';
+    this.version = '3.6.7';
     this.name = 'nicescroll';
     this.name = 'nicescroll';
 
 
     this.me = me;
     this.me = me;
@@ -305,7 +310,23 @@
     this.cursorheight = 20;
     this.cursorheight = 20;
     this.scrollvaluemax = 0;
     this.scrollvaluemax = 0;
 
 
-    this.isrtlmode = (this.opt.rtlmode == "auto") ? ((this.win[0] == window ? this.body : this.win).css("direction") == "rtl") : (this.opt.rtlmode === true);
+    // http://dev.w3.org/csswg/css-writing-modes-3/#logical-to-physical
+    // http://dev.w3.org/csswg/css-writing-modes-3/#svg-writing-mode
+    if (this.opt.rtlmode == "auto") {
+      var target = this.win[0] == window ? this.body : this.win;
+      var writingMode = target.css("writing-mode") || target.css("-webkit-writing-mode") || target.css("-ms-writing-mode") || target.css("-moz-writing-mode");
+
+      if (writingMode == "horizontal-tb" || writingMode == "lr-tb" || writingMode == "") {
+        this.isrtlmode = (target.css("direction") == "rtl");
+        this.isvertical = false;
+      } else {
+        this.isrtlmode = (writingMode == "vertical-rl" || writingMode == "tb" || writingMode == "tb-rl" || writingMode == "rl-tb");
+        this.isvertical = (writingMode == "vertical-rl" || writingMode == "tb" || writingMode == "tb-rl");
+      }
+    } else {
+      this.isrtlmode = (this.opt.rtlmode === true);
+      this.isvertical = false;
+    }
     //    this.checkrtlmode = false;
     //    this.checkrtlmode = false;
     
     
     this.scrollrunning = false;
     this.scrollrunning = false;
@@ -362,15 +383,27 @@
     this.canhwscroll = (cap.hastransform && self.opt.hwacceleration);
     this.canhwscroll = (cap.hastransform && self.opt.hwacceleration);
     this.ishwscroll = (this.canhwscroll && self.haswrapper);
     this.ishwscroll = (this.canhwscroll && self.haswrapper);
 
 
-    this.hasreversehr = (this.isrtlmode&&!cap.iswebkit);  //RTL mode with reverse horizontal axis
-    
+    if (this.isrtlmode) { 
+      //RTL mode with reverse horizontal axis
+      if (this.isvertical) {
+        this.hasreversehr = !(cap.iswebkit || cap.isie || cap.isie11);
+      } else {
+        this.hasreversehr = !(cap.iswebkit || (cap.isie && !cap.isie10 && !cap.isie11));
+      }
+    } else {
+      this.hasreversehr = false;
+    }
+
     this.istouchcapable = false; // desktop devices with touch screen support
     this.istouchcapable = false; // desktop devices with touch screen support
 
 
     //## Check WebKit-based desktop with touch support
     //## Check WebKit-based desktop with touch support
     //## + Firefox 18 nightly build (desktop) false positive (or desktop with touch support)
     //## + Firefox 18 nightly build (desktop) false positive (or desktop with touch support)
-    if (cap.cantouch && !cap.isios && !cap.isandroid && (cap.iswebkit || cap.ismozilla)) {
+    
+    if (!cap.cantouch && (cap.hasw3ctouch||cap.hasmstouch)) {  // desktop device with multiple input
       this.istouchcapable = true;
       this.istouchcapable = true;
-      cap.cantouch = false; // parse normal desktop events
+    } else if (cap.cantouch && !cap.isios && !cap.isandroid && (cap.iswebkit || cap.ismozilla)) {
+      this.istouchcapable = true;
+//      cap.cantouch = false; // parse normal desktop events
     }
     }
 
 
     //## disable MouseLock API on user request
     //## disable MouseLock API on user request
@@ -384,6 +417,7 @@
     };
     };
 */    
 */    
 
 
+/*
     this.debounced = function(name, fn, tm) {
     this.debounced = function(name, fn, tm) {
       var dd = self.delaylist[name];
       var dd = self.delaylist[name];
       self.delaylist[name] = fn;
       self.delaylist[name] = fn;
@@ -396,6 +430,22 @@
         }, tm);
         }, tm);
       }
       }
     };
     };
+*/
+
+		this.debounced = function(name, fn, tm) {
+      if (!self) return;
+			var dd = self.delaylist[name]||false;
+			if (!dd) {
+				fn.call(self);				
+				self.delaylist[name] = {
+					h:setAnimationFrame(function(){
+						self.delaylist[name].fn.call(self);
+					  self.delaylist[name] = false;	
+					},tm)
+				};				
+			}			
+			self.delaylist[name].fn = fn;				
+		};
 
 
     var _onsync = false;
     var _onsync = false;
 
 
@@ -404,6 +454,7 @@
       function requestSync() {
       function requestSync() {
         if (_onsync) return;
         if (_onsync) return;
         setAnimationFrame(function() {
         setAnimationFrame(function() {
+          if (!self) return;
           _onsync = false;
           _onsync = false;
           for (var nn in self.synclist) {
           for (var nn in self.synclist) {
             var fn = self.synclist[nn];
             var fn = self.synclist[nn];
@@ -560,15 +611,33 @@
         return self.docscroll.scrollTop();
         return self.docscroll.scrollTop();
       };
       };
       this.setScrollTop = function(val) {
       this.setScrollTop = function(val) {
-        return setTimeout(function() {self.docscroll.scrollTop(val)}, 1);
+        return setTimeout(function() {(self)&&self.docscroll.scrollTop(val)}, 1);
       };
       };
       this.getScrollLeft = function() {
       this.getScrollLeft = function() {
-        if (self.detected.ismozilla && self.isrtlmode)
-          return Math.abs(self.docscroll.scrollLeft());
-        return self.docscroll.scrollLeft();
+        var val;
+        if (self.hasreversehr) {
+          if (self.detected.ismozilla) {
+            val = self.page.maxw - Math.abs(self.docscroll.scrollLeft());
+          } else {
+            val = self.page.maxw - self.docscroll.scrollLeft();
+          }
+        } else {
+          val = self.docscroll.scrollLeft();
+        }
+        return val;
       };
       };
       this.setScrollLeft = function(val) {
       this.setScrollLeft = function(val) {
-        return setTimeout(function() {self.docscroll.scrollLeft((self.detected.ismozilla && self.isrtlmode) ? -val : val)}, 1);
+        return setTimeout(function() {
+          if (!self) return;
+					if (self.hasreversehr) {
+						if (self.detected.ismozilla) {
+							val = -(self.page.maxw - val);
+						} else {
+							val = self.page.maxw - val;
+						}
+					}
+					return self.docscroll.scrollLeft(val);
+				}, 1);					
       };
       };
     }
     }
 
 
@@ -697,7 +766,6 @@
           });
           });
         }
         }
 
 
-
       }
       }
     };
     };
 
 
@@ -728,7 +796,7 @@
       setAnimationFrame = function(fn) {
       setAnimationFrame = function(fn) {
         return setTimeout(fn, 15 - Math.floor((+new Date()) / 1000) % 16);
         return setTimeout(fn, 15 - Math.floor((+new Date()) / 1000) % 16);
       }; // 1000/60)};
       }; // 1000/60)};
-      clearAnimationFrame = clearInterval;
+      clearAnimationFrame = clearTimeout;
     } else if (!self.hascancelanimationframe) clearAnimationFrame = function() {
     } else if (!self.hascancelanimationframe) clearAnimationFrame = function() {
       self.cancelAnimationFrame = true;
       self.cancelAnimationFrame = true;
     };
     };
@@ -1126,12 +1194,16 @@
             self.scrollmom = new ScrollMomentumClass2D(self);
             self.scrollmom = new ScrollMomentumClass2D(self);
 
 
             self.ontouchstart = function(e) {
             self.ontouchstart = function(e) {
+              console.log(e.type,e.pointerType);
+              
               if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false;
               if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false;
               
               
               self.hasmoving = false;
               self.hasmoving = false;
 
 
               if (!self.railslocked) {
               if (!self.railslocked) {
 
 
+							  console.log('touchstart ',e.type);
+							
                 var tg;
                 var tg;
                 if (cap.hasmstouch) {
                 if (cap.hasmstouch) {
                   tg = (e.target) ? e.target : false;
                   tg = (e.target) ? e.target : false;
@@ -1246,6 +1318,9 @@
               if (!self.rail.drag) return true;              
               if (!self.rail.drag) return true;              
               if (self.rail.drag.pt == 2) {
               if (self.rail.drag.pt == 2) {
                 if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false;
                 if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false;
+								
+								console.log('touchend:',e.target.nodeName);
+								
                 self.scrollmom.doMomentum();
                 self.scrollmom.doMomentum();
                 self.rail.drag = false;
                 self.rail.drag = false;
                 if (self.hasmoving) {
                 if (self.hasmoving) {
@@ -1443,6 +1518,9 @@
           self.onmouseup = function(e) {
           self.onmouseup = function(e) {
             if (self.rail.drag) {
             if (self.rail.drag) {
               if (self.rail.drag.pt != 1) return true;
               if (self.rail.drag.pt != 1) return true;
+							
+//							console.log('mouseup');
+							
               if (cap.hasmousecapture) document.releaseCapture();
               if (cap.hasmousecapture) document.releaseCapture();
               if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved.csspointerevents);              
               if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved.csspointerevents);              
               self.rail.drag = false;
               self.rail.drag = false;
@@ -1506,7 +1584,7 @@
 
 
             self.bind(self.win, "mousedown", self.ontouchstart); // control content dragging
             self.bind(self.win, "mousedown", self.ontouchstart); // control content dragging
 
 
-            self.onclick = (cap.isios) ? false : function(e) {
+            self.onclick = (cap.isios) ? false : function(e) {  // it needs to check IE11 ???
               if (self.lastmouseup) {
               if (self.lastmouseup) {
                 self.lastmouseup = false;
                 self.lastmouseup = false;
                 return self.cancelEvent(e);
                 return self.cancelEvent(e);
@@ -1735,14 +1813,18 @@
               });
               });
               //self.cursorh && self.bind(self.cursorh, "mousemove", self.onmousemove);
               //self.cursorh && self.bind(self.cursorh, "mousemove", self.onmousemove);
               self.cursorh && self.bind(self.cursorh, "mouseup", self.onmouseup);
               self.cursorh && self.bind(self.cursorh, "mouseup", self.onmouseup);
+            } else {
+              self.bind(self.rail, "mousedown", function(e){e.preventDefault();});  // prevent text selection             
+							self.railh&&self.bind(self.railh, "mousedown", function(e){e.preventDefault();});
             }
             }
 
 
           }
           }
+            
 
 
           if (self.opt.enablemousewheel) {
           if (self.opt.enablemousewheel) {
-            if (!self.isiframe) self.bind((cap.isie && self.ispage) ? document : self.win /*self.docscroll*/ , "mousewheel", self.onmousewheel);
-            self.bind(self.rail, "mousewheel", self.onmousewheel);
-            if (self.railh) self.bind(self.railh, "mousewheel", self.onmousewheelhr);
+            if (!self.isiframe) self.mousewheel((cap.isie && self.ispage) ? document : self.win , self.onmousewheel);
+            self.mousewheel(self.rail, self.onmousewheel);
+            if (self.railh) self.mousewheel(self.railh, self.onmousewheelhr);
           }
           }
 
 
           if (!self.ispage && !cap.cantouch && !(/HTML|^BODY/.test(self.win[0].nodeName))) {
           if (!self.ispage && !cap.cantouch && !(/HTML|^BODY/.test(self.win[0].nodeName))) {
@@ -1898,7 +1980,7 @@
           self.observerbody = new ClsMutationObserver(function(mutations) {
           self.observerbody = new ClsMutationObserver(function(mutations) {
             mutations.forEach(function(mut){
             mutations.forEach(function(mut){
               if (mut.type=="attributes") {
               if (mut.type=="attributes") {
-                return ($("body").hasClass("modal-open") && !$.contains($('.modal-dialog')[0],self.doc[0])) ? self.hide() : self.show();  // Support for Bootstrap modal; Added check if the nice scroll element is inside a modal
+                return ($("body").hasClass("modal-open") && $("body").hasClass("modal-dialog") && !$.contains($('.modal-dialog')[0],self.doc[0])) ? self.hide() : self.show();  // Support for Bootstrap modal; Added check if the nice scroll element is inside a modal
               }
               }
             });  
             });  
             if (document.body.scrollHeight!=self.page.maxh) return self.lazyResize(30);
             if (document.body.scrollHeight!=self.page.maxh) return self.lazyResize(30);
@@ -2023,7 +2105,7 @@
           }
           }
 
 
           if (self.opt.enablemousewheel) {
           if (self.opt.enablemousewheel) {
-            self.bind(doc, "mousewheel", self.onmousewheel);
+            self.mousewheel(doc, self.onmousewheel);
           }
           }
 
 
           if (self.opt.enablekeyboard) self.bind(doc, (cap.isopera) ? "keypress" : "keydown", self.onkeypress);
           if (self.opt.enablekeyboard) self.bind(doc, (cap.isopera) ? "keypress" : "keydown", self.onkeypress);
@@ -2273,9 +2355,21 @@
 
 
     this.resize = self.onResize;
     this.resize = self.onResize;
 
 
+		this.hlazyresize = 0;
+		
     this.lazyResize = function(tm) { // event debounce
     this.lazyResize = function(tm) { // event debounce
+/*		
       tm = (isNaN(tm)) ? 30 : tm;
       tm = (isNaN(tm)) ? 30 : tm;
       self.debounced('resize', self.resize, tm);
       self.debounced('resize', self.resize, tm);
+*/
+
+//			if (!self.haswrapper&&self.opt.autohidemode!==false) self.hide();	
+			if (!self.haswrapper) self.hide();	
+			if (self.hlazyresize) clearTimeout(self.hlazyresize);
+			self.hlazyresize = setTimeout(function(){
+				self.show().resize();
+			},240);
+			
       return self;
       return self;
     };
     };
 
 
@@ -2300,8 +2394,9 @@
         };
         };
 
 
         if (name == "mousewheel") {
         if (name == "mousewheel") {
-          event.deltaY = -1 / 40 * e.wheelDelta;
           e.wheelDeltaX && (event.deltaX = -1 / 40 * e.wheelDeltaX);
           e.wheelDeltaX && (event.deltaX = -1 / 40 * e.wheelDeltaX);
+					e.wheelDeltaY && (event.deltaY = -1 / 40 * e.wheelDeltaY);
+					!event.deltaY && !event.deltaX && (event.deltaY = -1 / 40 * e.wheelDelta);
         } else {
         } else {
           event.deltaY = e.detail;
           event.deltaY = e.detail;
         }
         }
@@ -2321,53 +2416,25 @@
       });
       });
       $(dom).bind(name, fn);
       $(dom).bind(name, fn);
     };
     };
-
-    this.bind = function(dom, name, fn, bubble) { // touch-oriented & fixing jquery bind
+    
+    this.mousewheel = function(dom, fn, bubble) { // bind mousewheel
       var el = ("jquery" in dom) ? dom[0] : dom;
       var el = ("jquery" in dom) ? dom[0] : dom;
-
-      if (name == 'mousewheel') {
-        if ("onwheel" in self.win) { // modern brosers & IE9 detection fix
-          self._bind(el, "wheel", fn, bubble || false);
-        } else {
-          var wname = (typeof document.onmousewheel != "undefined") ? "mousewheel" : "DOMMouseScroll"; // older IE/Firefox
-          _modernWheelEvent(el, wname, fn, bubble || false);
-          if (wname == "DOMMouseScroll") _modernWheelEvent(el, "MozMousePixelScroll", fn, bubble || false); // Firefox legacy
-        }
-      } else if (el.addEventListener) {
-        if (cap.cantouch && /mouseup|mousedown|mousemove/.test(name)) { // touch device support
-          var tt = (name == 'mousedown') ? 'touchstart' : (name == 'mouseup') ? 'touchend' : 'touchmove';
-          self._bind(el, tt, function(e) {
-            if (e.touches) {
-              if (e.touches.length < 2) {
-                var ev = (e.touches.length) ? e.touches[0] : e;
-                ev.original = e;
-                fn.call(this, ev);
-              }
-            } else if (e.changedTouches) {
-              var ev = e.changedTouches[0];
-              ev.original = e;
-              fn.call(this, ev);
-            } //blackberry
-          }, bubble || false);
-        }
-        self._bind(el, name, fn, bubble || false);
-        if (cap.cantouch && name == "mouseup") self._bind(el, "touchcancel", fn, bubble || false);
+      if ("onwheel" in document.createElement("div")) { // Modern browsers support "wheel"
+        self._bind(el, "wheel", fn, bubble || false);
       } else {
       } else {
-        self._bind(el, name, function(e) {
-          e = e || window.event || false;
-          if (e) {
-            if (e.srcElement) e.target = e.srcElement;
-          }
-          if (!("pageY" in e)) {
-            e.pageX = e.clientX + document.documentElement.scrollLeft;
-            e.pageY = e.clientY + document.documentElement.scrollTop;
-          }
-          return ((fn.call(el, e) === false) || bubble === false) ? self.cancelEvent(e) : true;
-        });
+        var wname = (typeof document.onmousewheel != "undefined") ? "mousewheel" : "DOMMouseScroll"; // older Webkit+IE support or older Firefox          
+        _modernWheelEvent(el, wname, fn, bubble || false);
+        if (wname == "DOMMouseScroll") _modernWheelEvent(el, "MozMousePixelScroll", fn, bubble || false); // Firefox legacy
       }
       }
     };
     };
-
-    if (cap.haseventlistener) {  // W3C standard model
+    
+    if (cap.haseventlistener) {  // W3C standard event model
+    
+      this.bind = function(dom, name, fn, bubble) {  // W3C
+        var el = ("jquery" in dom) ? dom[0] : dom;
+        self._bind(el, name, fn, bubble || false);
+      }
+    
       this._bind = function(el, name, fn, bubble) { // primitive bind
       this._bind = function(el, name, fn, bubble) { // primitive bind
         self.events.push({
         self.events.push({
           e: el,
           e: el,
@@ -2381,7 +2448,7 @@
       this.cancelEvent = function(e) {
       this.cancelEvent = function(e) {
         if (!e) return false;
         if (!e) return false;
         var e = (e.original) ? e.original : e;
         var e = (e.original) ? e.original : e;
-        e.preventDefault();
+        if (e.cancelable) e.preventDefault();
         e.stopPropagation();
         e.stopPropagation();
         if (e.preventManipulation) e.preventManipulation(); //IE10
         if (e.preventManipulation) e.preventManipulation(); //IE10
         return false;
         return false;
@@ -2396,6 +2463,22 @@
         el.removeEventListener(name, fn, bub);
         el.removeEventListener(name, fn, bub);
       };
       };
     } else {  // old IE model
     } else {  // old IE model
+
+      this.bind = function(dom, name, fn, bubble) {  // legacy IE
+        var el = ("jquery" in dom) ? dom[0] : dom;
+        self._bind(el, name, function(e) {
+          e = e || window.event || false;
+          if (e) {
+            if (e.srcElement) e.target = e.srcElement;
+          }
+          if (!("pageY" in e)) {
+            e.pageX = e.clientX + document.documentElement.scrollLeft;
+            e.pageY = e.clientY + document.documentElement.scrollTop;
+          }
+          return ((fn.call(el, e) === false) || bubble === false) ? self.cancelEvent(e) : true;
+        });
+      }
+    
       this._bind = function(el, name, fn, bubble) { // primitive bind
       this._bind = function(el, name, fn, bubble) { // primitive bind
         self.events.push({
         self.events.push({
           e: el,
           e: el,
@@ -2492,7 +2575,8 @@
     this.remove = function() {
     this.remove = function() {
       self.stop();
       self.stop();
       if (self.cursortimeout) clearTimeout(self.cursortimeout);
       if (self.cursortimeout) clearTimeout(self.cursortimeout);
-      if (self.debouncedelayed) clearTimeout(self.debouncedelayed);
+//      if (self.debouncedelayed) clearTimeout(self.debouncedelayed);
+			for(var n in self.delaylist) if (self.delaylist[n]) clearAnimationFrame(self.delaylist[n].h);
       self.doZoomOut();
       self.doZoomOut();
       self.unbindAll();
       self.unbindAll();
 
 
@@ -2640,6 +2724,9 @@
         
         
       }
       }
 
 
+      // invert horizontal direction for rtl mode
+      if (self.isrtlmode) px = -px;
+
       if (px) {
       if (px) {
         if (self.scrollmom) {
         if (self.scrollmom) {
           self.scrollmom.stop()
           self.scrollmom.stop()
@@ -2665,7 +2752,8 @@
           self.scrollmom.stop()
           self.scrollmom.stop()
         }
         }
         self.lastdeltay += py;
         self.lastdeltay += py;
-        self.debounced("mousewheely", function() {
+//        self.debounced("mousewheely", function() {
+	      self.synched("mousewheely", function() {
           var dt = self.lastdeltay;
           var dt = self.lastdeltay;
           self.lastdeltay = 0;
           self.lastdeltay = 0;
           if (!self.rail.drag) {
           if (!self.rail.drag) {
@@ -2769,6 +2857,7 @@
         var ex = (istime) ? ((dif > 20) ? dif : 0) : self.getTransitionSpeed(dif);
         var ex = (istime) ? ((dif > 20) ? dif : 0) : self.getTransitionSpeed(dif);
         var trans = (ex) ? cap.prefixstyle + 'transform ' + ex + 'ms ease-out' : '';
         var trans = (ex) ? cap.prefixstyle + 'transform ' + ex + 'ms ease-out' : '';
         if (!self.lasttransitionstyle || self.lasttransitionstyle != trans) {
         if (!self.lasttransitionstyle || self.lasttransitionstyle != trans) {
+//					console.log(trans);
           self.lasttransitionstyle = trans;
           self.lasttransitionstyle = trans;
           self.doc.css(cap.transitionstyle, trans);
           self.doc.css(cap.transitionstyle, trans);
         }
         }
@@ -3430,14 +3519,14 @@
 
 
             if (self.speedx) {
             if (self.speedx) {
               var scx = self.nc.getScrollLeft();
               var scx = self.nc.getScrollLeft();
-              if (scx != self.chkx) self.stop();
+//              if (scx != self.chkx) self.stop();
               self.chkx = nx;
               self.chkx = nx;
               self.nc.setScrollLeft(nx);
               self.nc.setScrollLeft(nx);
             }
             }
 
 
             if (self.speedy) {
             if (self.speedy) {
               var scy = self.nc.getScrollTop();
               var scy = self.nc.getScrollTop();
-              if (scy != self.chky) self.stop();
+//              if (scy != self.chky) self.stop();
               self.chky = ny;
               self.chky = ny;
               self.nc.setScrollTop(ny);
               self.nc.setScrollTop(ny);
             }
             }
@@ -3641,3 +3730,4 @@
   }
   }
 
 
 }));
 }));
+

文件差異過大導致無法顯示
+ 0 - 119
jquery.nicescroll.min.js


+ 10 - 2
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "nicescroll",
   "name": "nicescroll",
-  "version": "3.6.6",
+  "version": "3.6.7",
   "repository": {
   "repository": {
     "type": "git",
     "type": "git",
     "url": "https://github.com/inuyaksa/jquery.nicescroll"
     "url": "https://github.com/inuyaksa/jquery.nicescroll"
@@ -15,7 +15,15 @@
       "type": "MIT",
       "type": "MIT",
       "url": "MIT.LICENSE"
       "url": "MIT.LICENSE"
     }
     }
-  ],
+  ],	
+	"autoupdate": {
+    "source": "git",
+    "target": "git://github.com/inuyaksa/jquery.nicescroll.git",
+    "basePath": "dist",
+    "files": [
+      "**/*"
+    ]
+  },	
   "description": "Nicescroll is a jquery plugin, for nice customizabled scrollbars with a very similar ios/mobile style. It supports DIVs, IFrames and document page (body) scrollbars. Compatible with Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+ (all A-grade browsers). Compatible with iOS devices as iPad, Android, Blackberry, Windows Phone, and many many mobile and touch devices.",
   "description": "Nicescroll is a jquery plugin, for nice customizabled scrollbars with a very similar ios/mobile style. It supports DIVs, IFrames and document page (body) scrollbars. Compatible with Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+ (all A-grade browsers). Compatible with iOS devices as iPad, Android, Blackberry, Windows Phone, and many many mobile and touch devices.",
   "keywords": [
   "keywords": [
     "nicescroll",
     "nicescroll",

部分文件因文件數量過多而無法顯示