- My CSS backgrounds don’t work when I deploy them on my phone. Should I throw out my iPhone?
Next time you have this problem, check the background-attachment on the image in question. The culprit might be that it is ‘fixed’, which is a state that many mobile devices don’t support. You can work around this in many ways. I chose to put in a query that changes the background-attachment to “scroll” (aka the default) when on a touch device:
2. My ‘if’ statements in my script aren’t working! Are && and || a total lie??
Based on this, the answers “Trudeau”, “trudeau”, “justin trudeau”, and “Justin Trudeau” should all be correct. Let’s test it!
Yay! That works perfectly. Or does it?
SOLUTION: Every time you write an && or || logical operator, you need the start the next boolean expression from scratch. The correct way of writing the above code would be:
Let’s test it:
3. I’ve deployed my website, and some of my links just DON’T WORK on some devices! But they work on others! Am I taking crazy pills? Who invented this?
On my most recent project, I used jQuery to link my index.html page to another page of my website. I used the method windows.location.replace(‘file_path”);
This worked perfectly fine while I was making the website. When I deployed it, something strange happened: the link would take you to a different URL depending on the device you use! My boyfriend and mom have the updated iOS on their phones, and their safari browsers linked them to a different URL than my older iOS phone’s — they received errors but I didn’t, although I did receive an error on my macbook’s safari. How could the same link take different devices to different places?
SOLUTION: The above method isn’t supported by all browsers. A better alternative would be to simply use windows.location.