jQuery Mobile: Stick footer to bottom of page

后端 未结 10 907
一个人的身影
一个人的身影 2020-12-04 09:40

Is there any way, bearing in mind the way the jQuery Mobile framework operates, to fix the page so that the footer always aligns with the bottom of the page - no matter the

10条回答
  •  悲&欢浪女
    2020-12-04 10:19

    This script seemed to work for me...

    $(function(){
        checkWindowHeight();
        $(document).bind('orientationchange',function(event){
            checkWindowHeight();
        })
    });
    
    function checkWindowHeight(){
            $('[data-role=content]').each(function(){
            var containerHeight = parseInt($(this).css('height'));
            var windowHeight = parseInt(window.innerHeight);
            if(containerHeight+118 < windowHeight){
                var newHeight = windowHeight-118;
                $(this).css('min-height', newHeight+'px');
            }
        });
    }
    

提交回复
热议问题