Created
December 14, 2011 20:33
-
-
Save Eclarian/1478375 to your computer and use it in GitHub Desktop.
jQuery Version Function
This file contains hidden or 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
/** | |
* jQuery Version returned as 3 digit integer | |
* | |
* Allows you to perform version ranges if ( jQueryVersion() < 170 ) | |
* Useful for plugin dev with events and dealing with live, delegate, and on | |
* | |
* @author Eclarian LLC | |
* @return integer | |
*/ | |
var jQueryVersion = function() { | |
var jQueryVersion = $.fn.jquery; | |
jQueryVersion = jQueryVersion ? jQueryVersion.split('.'): []; | |
// Since some versions do not include the third point (why NOT?!) | |
while ( jQueryVersion.length < 3 ) { | |
jQueryVersion.push(0); | |
} | |
return parseInt(jQueryVersion.join("")); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment