jquery mobile background image

前端 未结 11 1991
青春惊慌失措
青春惊慌失措 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 05:12

    my experience:

    in some situations the background image url have to be put separately for all page parts - I use:

    var bgImageUrl = "url(../thirdparty/icons/android-circuit.jpg)";
    
    ...
    
    $('#indexa').live('pageinit', function() {
    
       $("#indexa").css("background-image",bgImageUrl);
       $("#contenta").css("background-image",bgImageUrl);
       $("#footera").css("background-image",bgImageUrl);
       ...
    }
    

    where "indexa" is the id of the whole page, and the "contenta" and "footera" are id-s of the content and footer respectively.

    This works for sure in PhoneGap + jQuery Mobile

提交回复
热议问题