jQuery Mobile: Stick footer to bottom of page

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

    Adding the data-position="fixed" and adding the below style in the css will fix the issue z-index: 1;

    0 讨论(0)
  • 2020-12-04 10:27

    Since this issue is kind of old a lot of things have changed.

    You can now get this behavior by adding this to the footer div

    data-position="fixed"
    

    More info here: http://jquerymobile.com/test/docs/toolbars/bars-fixed.html

    Also beware, if you use the previously mentioned CSS together with the new JQM solution you will NOT get the appropriate behavior!

    0 讨论(0)
  • 2020-12-04 10:27

    http://ryanfait.com/sticky-footer/

    You could possibly use this and use jQuery to update the css height of the elements to make sure it stays in place.

    0 讨论(0)
  • 2020-12-04 10:30

    The following lines work just fine...

    var headerHeight = $( '#header' ).height();
    var footerHeight = $( '#footer' ).height();
    var footerTop = $( '#footer' ).offset().top;
    var height = ( footerTop - ( headerHeight + footerHeight ) );
    $( '#content' ).height( height );
    
    0 讨论(0)
提交回复
热议问题