i have element which have misc height. I need to add some margin-top to other element according as this first block. I was used for this action jQuery height property but it’s does’t work. Can you help me?
This is my code:
$(document).ready(function(){
if ($('.post_discussion_header').height(79) + 'px'){
$('.no_0').css('margin-top','110px');
}
});
});
TIA.
Your if statement is wrong, it should be
however you may consider using offset height which returns the height of an element, including borders and padding if any, but not margins https://developer.mozilla.org/en/DOM/element.offsetHeight
EDIT: added parseInt to convert the “79px” to 79 for comparison http://www.w3schools.com/jsref/jsref_parseInt.asp
Also you have one too many }); in your code. Line 5 should just be }