jQuery Mobile: Stick footer to bottom of page

后端 未结 10 913
一个人的身影
一个人的身影 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:08

    I thought I'd share my CSS only solution here. This way you can avoid the extra overhead of using JS for this.

    This isn't a fixed position footer. The footer will be offscreen if the page content is taller than the screen. I think it looks better this way.

    The body and .ui-page min-height and height are necessary to prevent the footer from jumping up and down during transitions.

    Works with the latest JQM version as of now, 1.4.0

    body,
    .ui-page {
        min-height:100% !important;
        height:auto !important;
    }
    
    .ui-content {
        margin-bottom:42px; /* HEIGHT OF YOUR FOOTER */
    }
    
    .ui-footer {
        position:absolute !important;
        width:100%;
        bottom:0;
    }
    

提交回复
热议问题