How to pass variables in jQuery.css({})

How to pass variables in jQuery.css({})

Hi,

I'm currently using the browser detection from Peter-Paul Koch for border-radius.

I added this to my code :

  1. BrowserDetect.init();
  2. if (BrowserDetect.browser === 'Safari')
  3. {
  4. radius_b = '-webkit-border-radius';
  5. radius_btl = '-webkit-border-top-left-radius';
  6. radius_btr = '-webkit-border-top-right-radius';
  7. radius_bbr = '-webkit-border-bottom-right-radius';
  8. radius_bbl = '-webkit-border-bottom-left-radius';
  9. } else if (BrowserDetect.browser === 'Firefox') {
  10. radius_b = '-moz-border-radius';
  11. radius_btl = '-moz-border-radius-topleft';
  12. radius_btr = '-moz-border-radius-topright';
  13. radius_bbr = '-moz-border-radius-bottomright';
  14. radius_bbl = '-moz-border-radius-bottomleft';
  15. } else {
  16. radius_b = 'borderRadius';
  17. radius_btl = 'borderTopLeftRadius';
  18. radius_btr = 'borderTopRightRadius';
  19. radius_bbr = 'borderBottomRightRadius';
  20. radius_bbl = 'borderBottomLeftRadius';
  21. }
So now, when I'm doing this :

  1. $('foo').css(radius_b, '20px');
It works great on all CCS3 ready browser. But when I add a map, it's not working anymore :

  1. $('foo').css({
  2.                 // Don't work
  3. radius_btr: '20px',
  4. radius_btl: '20px',
  5.                 // works
  6.                 color: 'blue'
  7. });
Why :'( ? Is there a little plugin for doing that (don't care of IE, I only want CSS3 properties).