jquery mobile background image

前端 未结 11 1959
青春惊慌失措
青春惊慌失措 2020-12-13 04:36

I am building a jQuery mobile site, and I am trying to insert a scalable image into the background, which would adjust to screen size of the phone. This is my code:

相关标签:
11条回答
  • 2020-12-13 04:55

    With JQM 1.4.2 this one works for me (Change theme to the used one):

    .ui-page-theme-b, .ui-page-theme-b .ui-panel-wrapper {
        background: transparent url(../img/xxx) !important;
        background-repeat:repeat !important;
    }
    
    0 讨论(0)
  • 2020-12-13 04:57

    For jquery mobile and phonegap this is the correct code:

    <style type="text/css">
    body {
        background: url(imgage.gif);
        background-repeat:repeat-y;
        background-position:center center;
        background-attachment:scroll;
        background-size:100% 100%;
    }
    .ui-page {
        background: transparent;
    }
    .ui-content{
        background: transparent;
    }
    </style>
    
    0 讨论(0)
  • 2020-12-13 04:58

    I found this answer works for me

    <style type="text/css">
    #background{ 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100% !important; 
    height: 100% !important; 
    background: url(mobile-images/limo-service.jpg) no-repeat center center fixed !important; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
    z-index: -1; 
    } 
    .ui-page{ 
    background:none; 
    }
    </style>    
    

    also add id="background" to the div for your content section

    <div data-role="page" data-theme="a">
      <div data-role="main" class="ui-content" id="background">
      </div>
    </div>
    
    0 讨论(0)
  • 2020-12-13 05:03

    Try this. This should work:

    <div data-role="page" id="page" style="background-image: url('#URL'); background-attachment: fixed; background-repeat: no-repeat; background-size: 100% 100%;"
        data-theme="a">
    
    0 讨论(0)
  • 2020-12-13 05:04

    None of the above worked for me using JQM 1.2.0

    This did work for me:

    .ui-page.ui-body-c {
        background: url(bg.png);
        background-repeat:no-repeat;
        background-position:center center;
        background-size:cover;  
    }
    
    0 讨论(0)
  • 2020-12-13 05:06

    Override ui-page class in your css:

    .ui-page {
        background: url("image.gif");
        background-repeat: repeat;
    }
    
    0 讨论(0)
提交回复
热议问题