开发者

Calculate element height and apply to other element

开发者 https://www.devze.com 2023-04-12 17:22 出处:网络
Using a \'sticky footer\', I need to have the bottom padding on the content div equal to the footer height.

Using a 'sticky footer', I need to have the bottom padding on the content div equal to the footer height.

I would like to use jQuery to grab the footer height and apply that value to the content div bottom padding value.

Hope t开发者_运维问答hat makes sense!

Thanks


var height = $('#footer').height();
$('#content').css('padding-bottom',height+'px');

I think this is the solution to your problem


var height = $('#footer').height();

$('.other').css('paddingBottom', height);


Could you paste some code? :)

<script type="text/javascript">
$(document).ready(function() {

    var footerheight = $('#footer').height();
    $('#contentarea').css('padding-bottom',footerheight+'px');

});
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号