css - jquery height() returning 0 value -
i have small script written center content of div setting padding top & bottom adjacent div: $(document).ready(function() { $('.index-block:first').css({ 'padding-top': (($(window).height() - $('.cta').height()) / 4) - $('footer').height() + "px", 'padding-bottom': (($(window).height() - $('.cta').height()) / 4) - $('footer').height() + "px" }); $('.search').css({ 'padding-top': ($('.brand').height() - $('.search').height()) / 4 + "px", 'padding-bottom': ($('.brand').height() - $('.search').height()) / 4 + "px" }); alert('brand: ' + $('.brand').height() + ' | search: ' + $('.search').height()); }); html: <div class="index-block cta row"> <div class="col-md-4 brand"> <img src="/static/ima...