Skip to content

Commit 6db1bdc

Browse files
authored
Merge pull request #1094 from dpalou/MOBILE-2170
MOBILE-2170 ionic: Fix scroll with trackpad when hovering deep items
2 parents 4214e94 + 8e374a3 commit 6db1bdc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

www/core/main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ angular.module('mm.core', ['pascalprecht.translate'])
277277
}
278278
}
279279
});
280+
280281
$window.addEventListener('native.keyboardhide', function(e) {
281282
$mmEvents.trigger(mmCoreEventKeyboardHide, e);
282283

@@ -285,6 +286,16 @@ angular.module('mm.core', ['pascalprecht.translate'])
285286
ionic.trigger('resize');
286287
}
287288
});
289+
290+
if (!$mmApp.isDevice()) {
291+
// Re-define getParentOrSelfWithClass to change the default value of the depth param.
292+
// This is to allow scrolling with trackpad when hovering deep elements.
293+
var originalFunction = ionic.DomUtil.getParentOrSelfWithClass;
294+
ionic.DomUtil.getParentOrSelfWithClass = function(e, className, depth) {
295+
depth = depth || 20;
296+
return originalFunction(e, className, depth);
297+
};
298+
}
288299
});
289300

290301
// Send event when device goes online.

0 commit comments

Comments
 (0)