Ответы пользователя по тегу Bootstrap
  • Как привязать footer к низу экрана в Twitter Bootstrap?

    fearrr
    @fearrr
    Вот такое накидал решение.
    Вроде бы все учел.

    var footer = $('.footer'),
        pageContainer = $('.page-container'),
        fixClass = 'navbar-fixed-bottom';
    
        function stickyFooter() {
            var windowHeight  = $(window).height(),
                contentHeight = pageContainer.height(),
                footerHeight  = footer.height();
            footer.removeClass(fixClass);
            if (contentHeight <= windowHeight-footerHeight){
                footer.addClass(fixClass);
            }
        }
    
        stickyFooter();
        $(window).resize(function () {
            stickyFooter();
        });


    Пример html кода
    <div class="page-container">
        <section class="header"></section>
        <section class="nav"></section>
        <section class="content"></section>
    </div>
    <div class="footer">
    </div>
    Ответ написан
    Комментировать