javascript - how to substract two values in jquery -


hi want perform mathematical subtraction in jquery.

var whm = $(window).height()/2; var login_height = $("#login").outerheight(); var login_marign = (whm-login_height); 

but login_margin not work. how subtract value of these 2 variables?

what trying do? if trying find margin around login (i assume case looking @ variable name) can use .outermargin() function.

$('#login').outerheight(true); 

finds height of #login div including content, padding, border, , margin

$('#login').outerheight(); 

finds height of #login div including content, padding, border, not margin

so find margin around element do

var $login = $('#login'); $login.outerheight(true) - $login.outerheight(); 

this return height of top , bottom margin, , if equal divide 2 find it's value.

check out on http://jsfiddle.net/prt2j/1/


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -