Scroller with dynamically sized headers/footers

前端 未结 6 625
谎友^
谎友^ 2021-01-07 07:59

What I\'m looking for is to have a container div with any number of headers and footers which would then have another scrolling div in between the

6条回答
  •  猫巷女王i
    2021-01-07 08:11

    Building on DMoses answer, this solution involves just a bit more jquery, but it removes the issue of the scrollbar being slightly hidden by the footer/header

    the jQuery:

    $(document).ready(function(){
        $('.scroller').css("margin-top", $('.header').height());
    
        var height = $('.wrapper').height() - ($('.footer').height() + $('.header').height());
    
        $('.scroller').css("height", height);     
    });
    

    jsfiddle.net/XSADu/5/

提交回复
热议问题