فهرست منبع

3.7.2

Fixes
- support for Apple magic mouse swipe back/forward aka Enable only
if needed #378
- wrapper don't works on relative selector aka same
classes not working #635
- horizontal scrollbar visibible but no need it
on responsive layout
- tabindex start counter fix
- setAnimationFrame
for IE8
- touch interaction with multiple scrollareas with IE/Edge on
Surface
- mousewheel not working in safari & click event trigger twice
in mobile #669
- false retriggering of scrollend event
- Not scrolling
on lastest Firefox with HTML5 inside iframe #322

New options
-
scrollbarid, you can set id assigned to scrollbar (default: false =
auto-assigned)

Changes
- some code optimizations inspired from #604 by
dmadan86 (thank you so much!)
- better content area size detection
-
remove support for Windows Phone 7 and 7.1 (mango)
- minimal support
change to IE8

New script iframe helper
Needed to fix, in some
situation, browsers bad implementation of iframe events. (#322)
InuYaksa 8 سال پیش
والد
کامیت
d12bff18db

+ 15 - 14
README.md

@@ -1,7 +1,7 @@
 # jQuery.NiceScroll
-v. 3.7.0 2017-05-21
+v. 3.7.2 2017-06-18
 
- - [Web Site: nicescroll.areaaperta.com](http://nicescroll.areaaperta.com)
+ - [Web Site: nicescroll.areaaperta.com](https://nicescroll.areaaperta.com)
  - [Repo: github.com/inuyaksa/jquery.nicescroll](https://github.com/inuyaksa/jquery.nicescroll)
  - [Twitter: @nicescroll](https://twitter.com/nicescroll)
 
@@ -14,8 +14,8 @@ v. 3.7.0 2017-05-21
 
   - HORIZONAL scrollbar support!
   - It supports DIVs, IFrames, textarea, and document page (body) scrollbars.
-  - Compatible with all recent desktop browser and older: Firefox 4+, Chrome 5+, Safari 4+ (win/mac), Opera 10+, IE 6+. (all A-grade browsers)
-  - Compatible with mobile device: iPad/iPhone/iPod, Android 2.2+, Blackberry phones and Playbook (WebWorks/Table OS), Windows Phone 10 and older.
+  - Compatible with all recent desktop browser and older: Chrome, Firefox, Edge, IE8+, Safari (win/mac), Opera. (all A-grade browsers)
+  - Compatible with mobile device: iPad/iPhone/iPod, Android 4+, Blackberry phones and Playbook (WebWorks/Table OS), Windows Phone 8 and 10.
   - Compatible with all touch devices: iPad, Android tablets, Window Surface.
   - Compabible with multi-input device (mouse with touch or pen): Window Surface, Chrome Desktop on touch notebook.
   - Compatible with 2 directions mice: Apple Magic Mouse, Apple Mouser with 2-dir wheel, PC mouse with 2-dir wheel (if browser support it).
@@ -32,15 +32,14 @@ Using animationFrame for a smoothest and cpu-saving scrolling. (when browser sup
 "Use strict" tested script for maximum code quality.
 Bower and AMD ready.
 
-Warning for IE6 users (why do you uses IE6 yet? Please updgrade to a more stable and modern browser), some feature can't work for limitation of the browser.
-Document (body) scrollbars can't appears, old (native browser) one is used. Some issues with IFrame scrolling.
+Warning for IE6/7 users (why do you uses yet? Please updgrade to a more stable and modern browser), support for your browser has deprecated.
 
 
 ## FEATURES
 
 - simple installation and activation, it works with NO modification of your code. (some exceptions can happen, so you can write to me)
 - very stylish scrollbars, with no occupation on your window (original browser scrollbars need some of page space and reduces window/div usable width)
-- you can style main document scrollbar (body) too!! (not all script implements this feature)
+- you can style main document scrollbar (body) too!! (not all device/browser support this feature)
 - on all browsers you can scroll: dragging the cursor, mouse wheel (speed customizable), keyboard navigation (cursor keys, pagup/down keys, home/end keys)
 - scroll is smooth (as modern tablet browsing), speed is customizable
 - zoom feature
@@ -49,9 +48,9 @@ Document (body) scrollbars can't appears, old (native browser) one is used. Some
 - dragging scroll mode with scrolling momentum (as touch device)
 - tested for all major browsers desktop and mobile versions
 - support for touch devices
-- support for multi-input devices (IE10 with MSPointer)
-- compatible with many other browsers, including IE6, Safari on Mac and WP7 Mango!
-- very customizable aspect of bar
+- support for multi-input devices (MSPointer/Pointer support)
+- compatible with many other browsers and webkit derivated!
+- scrollbar has a lot a customizable features
 - native scroll events are working yet
 - fully integrated with jQuery
 - compatibile with jQuery UI, jQuery Touch, jQuery Mobile
@@ -59,7 +58,7 @@ Document (body) scrollbars can't appears, old (native browser) one is used. Some
 
 ## DEPENDENCIES
 >> It's a plugin for the jquery framework, you need to include jquery in your scripts.
->> From 1.5.x version and on. (I'd better to use 1.8.3+ minimum)
+>> it works with jQuery 1.x / 2.x / 3.x branch (slim version don't works)
 
 
 * INSTALLATION
@@ -67,7 +66,7 @@ Put loading script tag after jquery script tag and loading the zoom image in the
 
 <script src="jquery.nicescroll.js"></script>
 
-Copy image "zoomico.png" in the same folder of jquery.nicescroll.js.
+When you use zoom feature, copy image "zoomico.png" in the same folder of jquery.nicescroll.js.
 
 
 * HOW TO USE
@@ -120,7 +119,7 @@ $("#thisdiv").niceScroll({
     cursorwidth: "5px", // cursor width in pixel (you can also write "5px")
     cursorborder: "1px solid #fff", // css definition for cursor border
     cursorborderradius: "5px", // border radius in pixel for cursor
-    zindex: "auto" | <number>, // change z-index for scrollbar div
+    zindex: "auto" | [number], // change z-index for scrollbar div
     scrollspeed: 60, // scrolling speed
     mousescrollstep: 40, // scrolling speed with mouse wheel (pixel)
     touchbehavior: false, // DEPRECATED!! use "touchemulate"
@@ -166,7 +165,9 @@ $("#thisdiv").niceScroll({
     oneaxismousemode: "auto", // it permits horizontal scrolling with mousewheel on horizontal only content, if false (vertical-only) mousewheel don't scroll horizontally, if value is auto detects two-axis mouse
     scriptpath: "" // define custom path for boxmode icons ("" => same script path)
     preventmultitouchscrolling: true // prevent scrolling on multitouch events
-    disablemutationobserver: false // force MutationObserver disabled
+    disablemutationobserver: false // force MutationObserver disabled,
+    enableobserver: true // enable DOM changing observer, it tries to resize/hide/show when parent or content div had changed
+    scrollbarid: false // set a custom ID for nicescroll bars 
 });
 ```
 

+ 0 - 40
changelog_3.7.0.txt

@@ -1,40 +0,0 @@
-Changelog nicescroll release 3.7.0
-http://nicescroll.areaaperta.com/
-https://github.com/inuyaksa/jquery.nicescroll
-
-
-Fixes
-- typos on touchaction for IE10+ #658
-- MS Edge (14+) detection fixed #655
-- webkitCancelRequestAnimationFrame deprecated #650
-- enableobserver option added #643
-- Bug in bower.json #617
-- Versions from "3.6.7" to "latest" brokes scroll on touch devices #634
-- Horizontal scroll doesn't work on mobile devices tested with chrome & firefox on Android #646
-- How to Scroll in Mobile Device #626
-- 3.6.7 not working on ios or android #574
-- On iPhone safari does not work #649
-- Touch scrolling leads to a click event on Windows touch (Edge and Firefox browser) #614
-- Nicescroll not working in IOS 9+ #611
-- fixed ghost horizontal scrollbar
-
-
-New options
-- enableobserver (default:true), attach Mutation Observers (or alternative observers) to monitoring any attribute change at nicescroll DOM, on performance issue you can disable
-
-
-Changes 
-- deprecated touchbehavior, new touchemulate option, name changing I hope solve many misunderstanding about this option meaning
-
-
-TODO
-- railpadding
-- railpadding top & bottom settings ignored - thanks to simovinci.bellissimo
-- honorcssoverflow
-- autohidemode:hover
-- check 2D scrolling
-- check text selection on cursor drag (testing)
-- recursive position:fixed check
-- check horiz mouse wheel scrolling speed on chrome
-- mouse pan scroll
-

+ 28 - 0
changelog_3.7.2.txt

@@ -0,0 +1,28 @@
+Changelog nicescroll release 3.7.2
+https://nicescroll.areaaperta.com/
+https://github.com/inuyaksa/jquery.nicescroll
+
+
+
+Fixes
+- support for Apple magic mouse swipe back/forward aka Enable only if needed #378
+- wrapper don't works on relative selector aka same classes not working #635
+- horizontal scrollbar visibible but no need it on responsive layout
+- tabindex start counter fix
+- setAnimationFrame for IE8
+- touch interaction with multiple scrollareas with IE/Edge on Surface
+- mousewheel not working in safari & click event trigger twice in mobile #669
+- false retriggering of scrollend event
+- Not scrolling on lastest Firefox with HTML5 inside iframe #322
+
+New options
+- scrollbarid, you can set id assigned to scrollbar (default: false = auto-assigned)
+
+Changes 
+- some code optimizations inspired from #604 by dmadan86 (thank you so much!)
+- better content area size detection
+- remove support for Windows Phone 7 and 7.1 (mango)
+- minimal support change to IE8
+
+New script iframe helper
+Needed to fix, in some situation, browsers bad implementation of iframe events. (#322)

+ 4 - 4
demo/browser.html

@@ -25,7 +25,7 @@ body {
 </style>
 
 <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
-<script src="js/jquery.nicescroll.min.js"></script>
+<script src="js/jquery.nicescroll.js"></script>
 
 <script>
   var nice = false;
@@ -98,7 +98,7 @@ body {
 	toCell(1,14,!nice.detected.cantouch);  
 	toCell(2,14,!nice.detected.cantouch);  
 	toCell(3,14,nice.detected.cantouch||nice.istouchcapable||nice.hasmstouch||nice.detected.hasw3ctouch);
-  toCell(4,14,nice.detected.isie9mobile);  
+  //toCell(4,14,nice.detected.isie9mobile);  
 	
   });
   
@@ -255,7 +255,7 @@ body {
     <td>Keyboard</td>
     <td>Mouse</td>
     <td>Touch/Pen</td>
-    <td>WP7.1(8)</td>
+    <td>&nbsp;</td>
     <td>&nbsp;</td>
 		<td>&nbsp;</td>
     <td>&nbsp;</td>
@@ -270,7 +270,7 @@ body {
 (5) more smooth native scroll and cpu saving<br />
 (6) some problem with zoom feature for browser limitation<br />
 (7) use native scrollbar for page<br />
-(8) simulated touch support for WP7.1 Mango</p>
+</p>
 <p>&nbsp; </p>
 
 <script type="text/javascript">

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 1
demo/js/jquery.nicescroll.min.js


BIN
demo/js/zoomico.png


+ 107 - 0
dist/jquery.nicescroll.iframehelper.js

@@ -0,0 +1,107 @@
+/* iframe script helper for jquery.nicescroll
+-- version 0.9.0
+-- copyright 2017-06-18 InuYaksa*2017
+-- licensed under the MIT
+--
+-- https://nicescroll.areaaperta.com/
+-- https://github.com/inuyaksa/jquery.nicescroll
+--
+*/
+
+(function (document,window) {
+
+    var body = document.body;
+    var parent = window.parent;
+
+    if (parent && ("createEvent" in document)) {
+
+        var isoldie = ("documentMode" in document);  // 11-
+        var ismsedge = ("msCredentials" in window);  // MS Edge 14+
+
+        function onwheel(e) {
+
+            var evt = document.createEvent("MouseEvents");
+            evt.initEvent('wheel', true, true);
+            evt.deltaMode = e.deltaMode;
+            evt.deltaX = e.deltaX;
+            evt.deltaY = e.deltaY;
+            evt.deltaZ = e.deltaZ;
+            evt.wheelDelta = e.wheelDelta;
+            evt.wheelDeltaX = e.wheelDeltaX;
+            evt.wheelDeltaY = e.wheelDeltaY;
+
+            parent.dispatchEvent(evt);
+        }
+
+        body.addEventListener("wheel", onwheel);
+
+    }
+
+    if (window.addEventListener) {
+
+        // https://davidwalsh.name/add-rules-stylesheets
+        var sheet = (function () {
+            var style = document.createElement("style");
+            style.appendChild(document.createTextNode(""));
+            document.head.appendChild(style);
+            return style.sheet;
+        })();
+
+        var tmrscroll = false;
+        var lastiframe = null;
+        var lastiframeviewport = null;
+        var lastscroll = [];
+
+        window.addEventListener("scroll", function (e) {
+            if (lastiframeviewport) {
+                //            var df = [ window.scrollX - lastscroll[0], window.scrollY - lastscroll[1] ];
+                window.scrollTo(lastscroll[0], lastscroll[1]);
+                //            lastiframeviewport.scrollBy(df[0],df[1]);
+                //            console.log(df);
+            }
+        });
+
+        function findNiceParent(t) {
+            do {
+                if ($.data(t, '__nicescroll') !== undefined) return t;
+                t = t.parentNode || false;
+            } while (t);
+            return false;
+        }
+
+        window.addEventListener("load", function () {
+
+            var hasstyle = false;
+
+            $.nicescroll.each(function () {
+                var nice = this;
+                nice.scrollstart(function () {
+                    console.log("start");
+                    if (!hasstyle) sheet.insertRule("iframe { pointer-events: none !important; }", 0);
+                    hasstyle = true;
+                });
+                nice.scrollend(function () {
+                    console.log("end");
+                    if (hasstyle) sheet.deleteRule(0);
+                    hasstyle = false;
+                });
+            });
+
+            $("iframe").each(function () {
+                this.addEventListener("mouseenter", function (e) {
+                    lastiframe = e.target;
+                    var chk = findNiceParent(lastiframe);
+                    lastiframeviewport = chk;
+                    //if (chk) lastiframeviewport = $(chk).getNiceScroll();                
+                    lastscroll = [window.scrollX, window.scrollY];
+                });
+                this.addEventListener("mouseleave", function (e) {
+                    lastiframe = lastiframeviewport = null;
+                });
+            });
+
+        });
+
+    }
+
+})(document,window);

+ 2 - 0
dist/jquery.nicescroll.iframehelper.min.js

@@ -0,0 +1,2 @@
+/* iframe helper for nicescroll v3.7.2 InuYaksa - MIT - https://nicescroll.areaaperta.com */
+!function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,o.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,o=t.parent;if(o&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var r=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,i=null,c=[];t.addEventListener("scroll",function(e){i&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){console.log("start"),e||r.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){console.log("end"),e&&r.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);i=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=i=null})})})}}(document,window);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 743 - 851
dist/jquery.nicescroll.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 1
dist/jquery.nicescroll.min.js


+ 107 - 0
jquery.nicescroll.iframehelper.js

@@ -0,0 +1,107 @@
+/* iframe script helper for jquery.nicescroll
+-- version 0.9.0
+-- copyright 2017-06-18 InuYaksa*2017
+-- licensed under the MIT
+--
+-- https://nicescroll.areaaperta.com/
+-- https://github.com/inuyaksa/jquery.nicescroll
+--
+*/
+
+(function (document,window) {
+
+    var body = document.body;
+    var parent = window.parent;
+
+    if (parent && ("createEvent" in document)) {
+
+        var isoldie = ("documentMode" in document);  // 11-
+        var ismsedge = ("msCredentials" in window);  // MS Edge 14+
+
+        function onwheel(e) {
+
+            var evt = document.createEvent("MouseEvents");
+            evt.initEvent('wheel', true, true);
+            evt.deltaMode = e.deltaMode;
+            evt.deltaX = e.deltaX;
+            evt.deltaY = e.deltaY;
+            evt.deltaZ = e.deltaZ;
+            evt.wheelDelta = e.wheelDelta;
+            evt.wheelDeltaX = e.wheelDeltaX;
+            evt.wheelDeltaY = e.wheelDeltaY;
+
+            parent.dispatchEvent(evt);
+        }
+
+        body.addEventListener("wheel", onwheel);
+
+    }
+
+    if (window.addEventListener) {
+
+        // https://davidwalsh.name/add-rules-stylesheets
+        var sheet = (function () {
+            var style = document.createElement("style");
+            style.appendChild(document.createTextNode(""));
+            document.head.appendChild(style);
+            return style.sheet;
+        })();
+
+        var tmrscroll = false;
+        var lastiframe = null;
+        var lastiframeviewport = null;
+        var lastscroll = [];
+
+        window.addEventListener("scroll", function (e) {
+            if (lastiframeviewport) {
+                //            var df = [ window.scrollX - lastscroll[0], window.scrollY - lastscroll[1] ];
+                window.scrollTo(lastscroll[0], lastscroll[1]);
+                //            lastiframeviewport.scrollBy(df[0],df[1]);
+                //            console.log(df);
+            }
+        });
+
+        function findNiceParent(t) {
+            do {
+                if ($.data(t, '__nicescroll') !== undefined) return t;
+                t = t.parentNode || false;
+            } while (t);
+            return false;
+        }
+
+        window.addEventListener("load", function () {
+
+            var hasstyle = false;
+
+            $.nicescroll.each(function () {
+                var nice = this;
+                nice.scrollstart(function () {
+                    console.log("start");
+                    if (!hasstyle) sheet.insertRule("iframe { pointer-events: none !important; }", 0);
+                    hasstyle = true;
+                });
+                nice.scrollend(function () {
+                    console.log("end");
+                    if (hasstyle) sheet.deleteRule(0);
+                    hasstyle = false;
+                });
+            });
+
+            $("iframe").each(function () {
+                this.addEventListener("mouseenter", function (e) {
+                    lastiframe = e.target;
+                    var chk = findNiceParent(lastiframe);
+                    lastiframeviewport = chk;
+                    //if (chk) lastiframeviewport = $(chk).getNiceScroll();                
+                    lastscroll = [window.scrollX, window.scrollY];
+                });
+                this.addEventListener("mouseleave", function (e) {
+                    lastiframe = lastiframeviewport = null;
+                });
+            });
+
+        });
+
+    }
+
+})(document,window);

+ 2 - 0
jquery.nicescroll.iframehelper.min.js

@@ -0,0 +1,2 @@
+/* iframe helper for nicescroll v3.7.2 InuYaksa - MIT - https://nicescroll.areaaperta.com */
+!function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,o.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,o=t.parent;if(o&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var r=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,i=null,c=[];t.addEventListener("scroll",function(e){i&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){console.log("start"),e||r.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){console.log("end"),e&&r.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);i=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=i=null})})})}}(document,window);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 743 - 851
jquery.nicescroll.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 1
jquery.nicescroll.min.js


+ 3 - 7
package.json

@@ -1,7 +1,7 @@
 {
   "name": "nicescroll",
-  "version": "3.7.0",
-  "bugs": "http://github.com/inuyaksa/jquery.nicescroll/issues",
+  "version": "3.7.2",
+  "bugs": "https://github.com/inuyaksa/jquery.nicescroll/issues",
   "repository": {
     "type": "git",
     "url": "[email protected]:inuyaksa/jquery.nicescroll.git"
@@ -11,7 +11,7 @@
     "name": "InuYaksa",
     "url": "https://github.com/inuyaksa"
   },
-  "licenses": "MIT",
+  "license": "MIT",
   "autoupdate": {
     "source": "git",
     "target": "git://github.com/inuyaksa/jquery.nicescroll.git",
@@ -69,10 +69,6 @@
   "dependencies": {
     "jquery": ">=1.8.3"
   },
-  "devDependencies": {
-    "grunt-contrib-copy": "^1.0.0",
-    "grunt-contrib-jshint": "^1.1.0"
-  },
   "npmName": "nicescroll",
   "npmFileMap": [
     {

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است