I am not using jquery mobile.
I built a template in WordPress and have a full width background that can be set to a different one for each page: Background_1.jpg = Home, Background_1.jpg = About, ens....
This is what is loaded in the front end:
<div id="bg">
<img id="background" src="images/Background_1.jpg" alt="background">
</div>
So my problem is the following:
When i get to the fluid grid layouts i would like to remove this element completely to speed up the load time.
I also dont want to hide it, i want to remove the html when the window size is smaller than 600px.
Has anyone done this before?
Many years later and lots of testing as well as training and general experience.
There are different solutions that I have found works best for instances like this:
I used PHP Image Library along side my WordPress to generate and load the images in the size and quality I want and allows me to change size on the fly.
For the screen/user-agent detection I use Mobile-Detect.
You can also combine both of these solutions for best results.
Use a media query in your css. Something like this:
This hides the css element if the window size is less than 767px. You do need the right markup in your html:
To hide a div on a mobile view, you need the right window size. This is about right from the bootstrap framework:
To implement this into your code, you would use:
Read up more here: Mobile Device Trick