I am writing jQuery animation for a cross-browser view effect. I need to tackle IE with the hack property _height and *height. I try to set the property with
$('#notice_container').css({'_margin-bottom':'auto', 'margin-bottom': '31px'});
But it doesn’t set _margin-bottom as I specified althrough margin-bottom is set.
So, my questions are how to set those IE specified properties with jQuery?
While not a direct answer of how to implement traditional IE CSS hacks with jQuery, you might be interested in a cleaner solution, outlined here:
http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
Basically, you use conditional comments to assign classes to the
htmlelement depending on which version of IE is running:Then target elements like this rather than using hacks:
Choose ids if you want or different class names. This is a very clean approach to “hacking” IE in general.