I currently have 4-5 views in my app, I use a flat scheme, and I use same background image which I set in CSS:
.km-flat .km-view .km-content {
background-image: url(../styles/images/background11.png);
background-size: cover;
background-repeat: no-repeat;
}
I want to have a function where a user can choose another background image. I've implemented a listview, where I get the item the user selects and then I implement a switch case as follows.
switch(text1)
{
case "1":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/background11.png')");
break;
case "2":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/background12.png')");
break;
case "3":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/background13.png')");
break;
case "4":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/ background14.png')");
break;
}
However I am not getting the desired results.Sometimes the image only switches for 1-2 view instead of all views. I also get an ugly screen flash when I navigate between views. It's as if every time I pick a new view, the new background image keeps being reset/updated which results in the screen flash
Can someone help me resolve these bugs?
.km-flat .km-view .km-content {
background-image: url(../styles/images/background11.png);
background-size: cover;
background-repeat: no-repeat;
}
I want to have a function where a user can choose another background image. I've implemented a listview, where I get the item the user selects and then I implement a switch case as follows.
switch(text1)
{
case "1":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/background11.png')");
break;
case "2":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/background12.png')");
break;
case "3":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/background13.png')");
break;
case "4":
$(".km-flat .km-view .km-content").css('background-image',"url('./styles/images/ background14.png')");
break;
}
However I am not getting the desired results.Sometimes the image only switches for 1-2 view instead of all views. I also get an ugly screen flash when I navigate between views. It's as if every time I pick a new view, the new background image keeps being reset/updated which results in the screen flash
Can someone help me resolve these bugs?