topical media & game development
lib-jquery-learning-code-11-selectors-jquery.css-selectors.js / js
jQuery.extend(jQuery.expr[':'], {
'css': function(element, index, matches, set) {
var parts = /([\w-]+)\s*([<>=]+)\s*(\d+)/
.exec(matches[3]);
var value = parseFloat(jQuery(element).css(parts[1]));
switch (parts[2]) {
case '<':
return value < parseInt(parts[3]);
case '<=':
return value <= parseInt(parts[3]);
case '=':
case '==':
return value == parseInt(parts[3]);
case '>=':
return value >= parseInt(parts[3]);
case '>':
return value > parseInt(parts[3]);
}
}
});
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.