开发者

jquery - changing bg image of a div on iPhone not working

开发者 https://www.devze.com 2023-02-22 04:48 出处:网络
I have the following code function bgchange(edit) { var bgurl; switch(edit) { case edit=\"categories\": bgurl = \'url(img/categories_bg.jpg)\';

I have the following code

function bgchange(edit)
{
var bgurl;
switch(edit)
{
case edit="categories":
bgurl = 'url(img/categories_bg.jpg)';
break;

case edit="ishot":
bgurl = 'url(img/appslist_bg.jpg)';
break;

default:
bgurl ='';
}
return bgurl;
};
bg =开发者_JS百科 bgchange(edit, id);
$('#wrapper').css("background", "black "+ bg + "no-repeat right");

Now, whenever you click a page, a bg should change, that works when I run it from the desktop, however when I run it from my iPhone, it's not working, is it because iPhone has a problem doing so, and if so - can I use a different command to change the bg?

Help is appreciated, Thanks


Well, the problem seemed to be that safari wasn't running the code for some reason, once I moved it away from the <head> everything worked just fine... weird.

0

精彩评论

暂无评论...
验证码 换一张
取 消