How to pass variables in jQuery.css({})
Hi,
I added this to my code :
- BrowserDetect.init();
- if (BrowserDetect.browser === 'Safari')
- {
- radius_b = '-webkit-border-radius';
- radius_btl = '-webkit-border-top-left-radius';
- radius_btr = '-webkit-border-top-right-radius';
- radius_bbr = '-webkit-border-bottom-right-radius';
- radius_bbl = '-webkit-border-bottom-left-radius';
- } else if (BrowserDetect.browser === 'Firefox') {
- radius_b = '-moz-border-radius';
- radius_btl = '-moz-border-radius-topleft';
- radius_btr = '-moz-border-radius-topright';
- radius_bbr = '-moz-border-radius-bottomright';
- radius_bbl = '-moz-border-radius-bottomleft';
- } else {
- radius_b = 'borderRadius';
- radius_btl = 'borderTopLeftRadius';
- radius_btr = 'borderTopRightRadius';
- radius_bbr = 'borderBottomRightRadius';
- radius_bbl = 'borderBottomLeftRadius';
- }
So now, when I'm doing this :
- $('foo').css(radius_b, '20px');
It works great on all CCS3 ready browser. But when I add a map, it's not working anymore :
- $('foo').css({
- // Don't work
- radius_btr: '20px',
- radius_btl: '20px',
- // works
- color: 'blue'
- });
Why :'( ? Is there a little plugin for doing that (don't care of IE, I only want CSS3 properties).