开发者

Calculate element height and apply to other element

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜