Try:
var contentDivHeight = parseInt($('#contentDiv').css('height'));
var calculatedHeight = contentDivHeight - 64 + "px";
alert(contentDivHeight)
alert(calculatedHeight)
-----Mensagem Original-----
De: "Jeremy Coulson" <jeremycoul...@gmail.com>
Para: "jQuery (English)" <jquery-en@googlegroups.com>
Enviada em: quarta-feira, 18 de março de 2009 13:26
Assunto: [jQuery] How do I subtract 64 pixels from the value of a div's
height?
Here is my code:
$(document).ready(function () {
var contentDivHeight = $('#contentDiv').css('height');
// pseudo-code: var calculatedHeight = ????
$("#clickMe").click(function(){
$("#leftNavBox-contentPages").animate({"height": calculatedHeight},
"fast");
});
});
I need the value of calculatedHeight to be 64 pixels less than
contentDiv. So, if contentDiv is 600px, calculatedHeight needs to be
536px.
Jeremy