From 25e173acc1331bcf9ed8cc49659f81aca84fc1da Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Wed, 26 Nov 2014 12:57:37 -0800 Subject: [PATCH] bug(scroll) Fix IE10 scroll issue. This addresses #2728 --- js/views/scrollView.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/js/views/scrollView.js b/js/views/scrollView.js index 9632fd53dde..70be5eef8c7 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -796,6 +796,24 @@ ionic.views.Scroll = ionic.views.View.inherit({ } }; + self.mouseWheel = ionic.animationFrameThrottle(function(e) { + var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll'); + if (scrollParent === self.__container) { + + self.hintResize(); + self.scrollBy( + (e.wheelDeltaX || e.deltaX || 0) / self.options.wheelDampen, + (-e.wheelDeltaY || e.deltaY || 0) / self.options.wheelDampen + ); + + self.__fadeScrollbars('in'); + clearTimeout(self.__wheelHideBarTimeout); + self.__wheelHideBarTimeout = setTimeout(function() { + self.__fadeScrollbars('out'); + }, 100); + } + }); + if ('ontouchstart' in window) { // Touch Events container.addEventListener("touchstart", self.touchStart, false); @@ -819,6 +837,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ document.addEventListener("MSPointerMove", self.touchMove, false); document.addEventListener("MSPointerUp", self.touchEnd, false); document.addEventListener("MSPointerCancel", self.touchEnd, false); + document.addEventListener("wheel", self.mouseWheel, false); } else { // Mouse Events @@ -862,24 +881,6 @@ ionic.views.Scroll = ionic.views.View.inherit({ mousedown = false; }; - self.mouseWheel = ionic.animationFrameThrottle(function(e) { - var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll'); - if (scrollParent === self.__container) { - - self.hintResize(); - self.scrollBy( - (e.wheelDeltaX || e.deltaX || 0) / self.options.wheelDampen, - (-e.wheelDeltaY || e.deltaY || 0) / self.options.wheelDampen - ); - - self.__fadeScrollbars('in'); - clearTimeout(self.__wheelHideBarTimeout); - self.__wheelHideBarTimeout = setTimeout(function() { - self.__fadeScrollbars('out'); - }, 100); - } - }); - container.addEventListener("mousedown", self.mouseDown, false); if(self.options.preventDefault) container.addEventListener("mousemove", self.mouseMoveBubble, false); document.addEventListener("mousemove", self.mouseMove, false);