Skip to content

Instantly share code, notes, and snippets.

@budiadiono
Forked from dshaw/min_jquery_version.js
Last active January 4, 2021 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save budiadiono/7954617 to your computer and use it in GitHub Desktop.
Save budiadiono/7954617 to your computer and use it in GitHub Desktop.
function minVersion(version) {
var $vrs = window.jQuery.fn.jquery.split('.'),
min = version.split('.'),
prevs=[];
for (var i=0, len=$vrs.length; i<len; i++) {
console.log($vrs[i], min[i], prevs[i-1]);
if (min[i] && $vrs[i] < min[i]) {
if (!prevs[i-1] || prevs[i-1] == 0)
return false;
} else {
if ($vrs[i] > min[i])
prevs[i] = 1;
else
prevs[i] = 0;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment