From e93d67e754cdbf357f2ad41fc85fd39547522116 Mon Sep 17 00:00:00 2001 From: maoziliang Date: Tue, 11 Jun 2013 23:44:36 +0800 Subject: [PATCH] Add feature to suport ie. For ie browser, the `.ps-container` element will add extra class `ie` and `ie`, like `ie6`, `ie7`, `ie8`, etc. --- src/perfect-scrollbar.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/perfect-scrollbar.js b/src/perfect-scrollbar.js index 2121905..9bf04f3 100644 --- a/src/perfect-scrollbar.js +++ b/src/perfect-scrollbar.js @@ -307,9 +307,19 @@ $this.data('perfect-scrollbar-destroy', null); }; + var ieSupport = function (version) { + $this.addClass('ie').addClass('ie' + version); + }; + var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent); var initialize = function () { + var ieMatch = navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/); + if (ieMatch && ieMatch[1] === 'msie') { + // must be executed at first, because 'ieSupport' may addClass to the container + ieSupport(parseInt(ieMatch[2], 10)); + } + updateBarSizeAndPosition(); bindMouseScrollXHandler(); bindMouseScrollYHandler();