Skip to content
Browse files

Quick fix for getComputedStyle issue in IE8 and below

  • Loading branch information...
1 parent ca61ab0 commit b8aabe05b736a6f92b97395a47e77c561527a743 @schickling schickling committed
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/jquery.overscroll.js
View
21 src/jquery.overscroll.js
@@ -5,7 +5,7 @@
*
* Intended for use with the latest jQuery
* http://code.jquery.com/jquery-latest.js
- *
+ *
* Copyright 2013, Jonathan Azoff
* Licensed under the MIT license.
* https://github.com/azoff/overscroll/blob/master/mit.license
@@ -31,6 +31,25 @@
);
}
+ // quick fix for IE 8 and below since getComputedStyle() is not supported
+ // TODO: find a better solution
+ if (!global.getComputedStyle) {
+ global.getComputedStyle = function (el, pseudo) {
+ this.el = el;
+ this.getPropertyValue = function (prop) {
+ var re = /(\-([a-z]){1})/g;
+ if (prop == 'float') prop = 'styleFloat';
+ if (re.test(prop)) {
+ prop = prop.replace(re, function () {
+ return arguments[2].toUpperCase();
+ });
+ }
+ return el.currentStyle[prop] ? el.currentStyle[prop] : null;
+ };
+ return this;
+ };
+ }
+
// runs feature detection for overscroll
var compat = {
animate: (function(){

0 comments on commit b8aabe0

Please sign in to comment.
Something went wrong with that request. Please try again.