mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(scrollView): on desktop, mousewheel only scrolls the right scrollView
Closes #1376
This commit is contained in:
2
js/angular/directive/content.js
vendored
2
js/angular/directive/content.js
vendored
@@ -47,7 +47,7 @@ function($timeout, $controller, $ionicBind) {
|
||||
compile: function(element, attr) {
|
||||
var innerElement;
|
||||
|
||||
element.addClass('scroll-content');
|
||||
element.addClass('scroll-content ionic-scroll');
|
||||
|
||||
if (attr.scroll != 'false') {
|
||||
//We cannot use normal transclude here because it breaks element.data()
|
||||
|
||||
2
js/angular/directive/scroll.js
vendored
2
js/angular/directive/scroll.js
vendored
@@ -31,7 +31,7 @@ function($timeout, $controller, $ionicBind) {
|
||||
scope: true,
|
||||
controller: function() {},
|
||||
compile: function(element, attr) {
|
||||
element.addClass('scroll-view');
|
||||
element.addClass('scroll-view ionic-scroll');
|
||||
|
||||
//We cannot transclude here because it breaks element.data() inheritance on compile
|
||||
var innerElement = jqLite('<div class="scroll"></div>');
|
||||
|
||||
@@ -250,17 +250,6 @@
|
||||
return null;
|
||||
},
|
||||
|
||||
elementHasParent: function(element, parent) {
|
||||
var current = element;
|
||||
while (current) {
|
||||
if (current.parentNode === parent) {
|
||||
return true;
|
||||
}
|
||||
current = current.parentNode;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionic.DomUtil#rectContains
|
||||
|
||||
@@ -838,12 +838,15 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
};
|
||||
|
||||
self.mouseWheel = ionic.animationFrameThrottle(function(e) {
|
||||
if (ionic.DomUtil.elementHasParent(e.target, self.__container)) {
|
||||
var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll');
|
||||
if (scrollParent === self.__container) {
|
||||
|
||||
self.hintResize();
|
||||
self.scrollBy(
|
||||
e.wheelDeltaX/self.options.wheelDampen,
|
||||
-e.wheelDeltaY/self.options.wheelDampen
|
||||
);
|
||||
|
||||
self.__fadeScrollbars('in');
|
||||
clearTimeout(self.__wheelHideBarTimeout);
|
||||
self.__wheelHideBarTimeout = setTimeout(function() {
|
||||
|
||||
Reference in New Issue
Block a user