I want to pass the following variable like so:
var $headerHeight = jQuery("#header").outerHeight() - jQuery("#header .main-menu").outerHeight();
jQuery(this).find('nav').attr('style', 'margin-top:' + $headerHeight + '!important');
It's obviously used in the wrong syntax; I just can't figure out how to use it correctly. The jQuery ".css" function isn't an option because it has to have the "!important" declaration. How can I pass $headerHeight in the above example?
!importanton an inline-style, inline styles override stylesheets unless the declaration is using!important. If that's the case, the correct fix would be to fix the css.+'px!important', however I do tend to agree, having to use important this way is a sign that you're doing something wrong.$.animate, it will result in much cleaner code than using slideDown with inline!important. slideDown's css changes will override your!importantanyway.