I am creating custom div scroller and want to set top position of content div. My jquery code is as below:
containerOuterHeight=$(\"#messagePopUpContainer\").out
You could also do
var x = $('#element').height(); // or any changing value
$('selector').css({'top' : x + 'px'});
OR
You can use directly
$('#element').css( "height" )
The difference between .css( "height" )
and .height()
is that the latter returns a unit-less pixel value (for example, 400
) while the former returns a value with units intact (for example, 400px
). The .height() method is recommended when an element's height needs to be used in a mathematical calculation. jquery doc