only show one background image on mobile devices

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Tue Oct 18, 2016 7:44 pm
Reply with quote
Report this post
Hi there

I inserted some css code to the override.css to add 5 background images. 4 of them don't repeat, one does.
Code: Select all
body {
   background-image:    
url(../images/background_comic_left.png),
url(../images/background_comic_right.png),
url(../images/background_comic_left_bottom.png),
url(../images/background_comic_right_bottom.png), 
url(../images/background_tuerkis.png);
   background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
   background-position: 0% 10%, 100% 10%, 0% 100%, 100% 100%, left top;
   color: #3a3637;


I now would like to hide 4 of these images (the ones that don't repeat) on the mobile version. How can I do that? I tried something like this:
Code: Select all
@media (max-width: 640px) {
   #gkBg{
background-image: url(../images/background_tuerkis.png);
background-repeat: repeat;
}
}

But the images still load on mobile devices.
URL: https://stefanscheibler.ch/buochs/
Any advice? Thanks in advance!
User avatar
Junior Boarder

teitbite
Thu Oct 20, 2016 10:17 am
Reply with quote
Report this post
Hi

You need to overwrite all of those images same way as it was added:

Code: Select all
body {
   background-image:   
none,
none,
none,
none,
url(../images/background_tuerkis.png);
   background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
   background-position: 0 0, 0 0, 0 0, 0 0, left top;
}
User avatar
Moderator

GK User
Thu Oct 20, 2016 12:50 pm
Reply with quote
Report this post
nice tipp! thank you!
I done it like that, if anyone is interested:
bodytag is not needed

Code: Select all
#gkBg{

background-image: url(../images/background_comic_left.png),
url(../images/background_comic_right.png),
url(../images/background_comic_left_bottom.png),
url(../images/background_comic_right_bottom.png),
url(../images/background_tuerkis.png);
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
background-position: 0% 10%, 100% 10%, 0% 100%, 100% 100%, left top;
color: #3a3637;
font-size: 14px;
font-weight: 400;
line-height: 1.7;
margin: 0;
min-height: 100%;
padding: 0;
word-wrap: break-word;
}



@media (max-width: 640px) {
#gkBg{

background-image: none,
none,
none,
none,
url(../images/background_tuerkis.png);
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
background-position: 0 0, 0 0, 0 0, 0 0, left top;
color: #3a3637;
font-size: 14px;
font-weight: 400;
line-height: 1.7;
margin: 0;
min-height: 100%;
padding: 0;
word-wrap: break-word;
}
}

I have to play now with the widths and probably will add another one!
THANK YOU AGAIN. Do you have a donate button somewhere? :mrgreen:
User avatar
Junior Boarder

teitbite
Fri Oct 21, 2016 3:22 pm
Reply with quote
Report this post
Hi

No we do not :) Happy I could help.
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.