From 68c297fe2c9e67c425020e9b067ef1619aa6db18 Mon Sep 17 00:00:00 2001 From: Zeno Zeng Date: Sat, 29 Jun 2013 01:14:40 +0800 Subject: [PATCH] Use `supportsTouch` instead of `isMobile`. --- src/perfect-scrollbar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/perfect-scrollbar.js b/src/perfect-scrollbar.js index 835a31b..10dbf91 100644 --- a/src/perfect-scrollbar.js +++ b/src/perfect-scrollbar.js @@ -352,7 +352,7 @@ } }; - var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent); + var supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch); var initialize = function () { var ieMatch = navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/); @@ -364,7 +364,7 @@ updateBarSizeAndPosition(); bindMouseScrollXHandler(); bindMouseScrollYHandler(); - if (isMobile) { + if (supportsTouch) { bindMobileTouchHandler(); } if ($this.mousewheel) {