Scroller with dynamically sized headers/footers

前端 未结 6 623
谎友^
谎友^ 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条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-07 08:14

    As stated by Matt Cooper, I don't think there's a css pure solution. Here's my attempt: jsfiddle

    var CalcHeight = function() {
        this.init = function() {
            var totHeight = $('body').height();
            var componentsHeight = $('.headers').height() + $('.footers').height();
            var diff = totHeight - componentsHeight;
            $('.hider').css({
                height: diff
            });
        }
    
        this.init();
    }
    
    var calcHeight = new CalcHeight;
    

提交回复
热议问题