Tuesday, 15 March 2011

JQuery: how to make this variable negative before declaring it as a CSS value? -



JQuery: how to make this variable negative before declaring it as a CSS value? -

var footerheight = $("footer").height(); $("#body2").css("padding-bottom",footerheight); $("footer").css("margin-top",footerheight); $("footer").css("height",footerheight); $(window).resize(function(){ $("#body2").paddingbottom("auto"); var footerheight = $("footer").height(); $("#body2").css("padding-bottom",footerheight); $("footer").css("margin-top",footerheight); $("footer").css("height",footerheight); });

the "footerheight" variable needs made negative before inputted "margin-top" value of footer's styling. how done?

jquery.css('key',num) accepts number.

so can this:

var footerheight = -$("footer").height();

jquery css

No comments:

Post a Comment