Created
July 24, 2012 13:29
-
-
Save johnhaitas/3169923 to your computer and use it in GitHub Desktop.
browser detector for FixedColumns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"_fnDetectBrowser": function () | |
{ | |
var ua = navigator.userAgent.toLowerCase(); | |
// userAgent RegExp | |
var rwebkit = /(webkit)[ \/]([\w.]+)/, | |
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, | |
rmsie = /(msie) ([\w.]+)/, | |
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, | |
rsafari = /(safari)[ \/]([\w.]+)/, | |
rchrome = /(chrome)[ \/]([\w.]+)/; | |
browser = { | |
webkit: rwebkit.test( ua ), | |
opera: ropera.test( ua ), | |
msie: rmsie.test( ua ), | |
safari: rsafari.test( ua ) && | |
!rchrome.test( ua ), | |
chrome: rchrome.test( ua ), | |
firefox: rmozilla.test( ua ) && | |
ua.indexOf("compatible") < 0 && | |
ua.indexOf("like") < 0 | |
}; | |
return browser; | |
}, | |
..... | |
"_fnBindEventHandlers": function () | |
{ | |
var that = this; | |
var browser = this._fnDetectBrowser(); | |
/* Event handlers */ | |
if ( that.s.iLeftColumns > 0 ) | |
{ | |
if ( !browser.firefox ) | |
{ | |
// do stuff for all browsers except Firefox | |
} else { | |
// do stuff for Firefox | |
} | |
if ( browser.safari ) | |
{ | |
// Bind to 'mousewheel' event only for Safari | |
} | |
} | |
/* do the rest of event bindings */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment