Rich-text Reply

Different background on mobile phone

Dalibr 03-20-15

Different background on mobile phone

Hello,

 

How can I change the image on mobile phone for a varioation?

Normally I do it like this

$("body").css({"background-image":'url("xxx.jpg")'});

 

On mobile I've tried to do it like this:

 

$("body").css("@media screen and (max-width: 480px){"background-image":'url("xxx.jpg")'}");

 

but doesn't work.

 

Any Ideas?

Regards

Level 1

td_evans 03-20-15
 

Re: Different background on mobile phone

[ Edited ]

I would suggest if you're writing a lot of HTML to add a unique class onto the body of the page, such as variation1.

 

Then use "Global CSS" to style the page in the usual way you do for CSS. I find this a lot simpler, and your media queries will work there.

Thomas Evans
Technical Product Manager - Conversion @ Secret Escapes

Level 2