|
ExtendCss
jquery.extendCSS.js
This is a plugin proposal to ease plugin translation. It currently support namespaces and language switching. ExampleFixing IE6Transparently fix the :hover and :first-child behavior in IE6
$.extendCSSif(($.browser.msie
&& parseInt($.browser.version, 10) < 7),
'pseudo-class', {
'hover': function(selector) {
var selector2 = selector.replace(':hover', '');
// new styles
var styles2 = this.getStyles(selector);
// original styles
var styles1 = this.getInitialStyles(selector2, styles2);
$(selector2).hover(function(){
$(this).css(styles2); // apply :hover styles
}, function(){
$(this).css(styles1); // restore original styles
});
},
'first-child': function(selector) {
var sel = selector.replace(':first-child', '');
$(sel).filter(':first').css(this.getStyles(sel));
}
});
Extending capabilitiesThis example implement -moz-border-radius in other browsers.
$extendCSSif(($.fn.corner && !$.browser.mozilla), 'property', {
'-moz-border-radius':
function(selector, value) { $(selector).corner(value); },
'-moz-border-radius-topLeft':
function(selector, value) { $(selector).corner('tl '+ value); },
'-moz-border-radius-bottomLeft':
function(selector, value) { $(selector).corner('bl '+ value); },
'-moz-border-radius-topRight':
function(selector, value) { $(selector).corner('tr '+value); },
'-moz-border-radius-topRight':
function(selector, value) { $(selector).corner('br '+value); }
});
|
Sign in to add a comment