PaulV Posted November 28, 2013 Share Posted November 28, 2013 I know i can use display:none, but the page has a lot of pics. The mobile page has less content and few pics. To load quicker and waste less bandwith i want to pics not to load on a mobile phone.How can I do that? Link to comment Share on other sites More sharing options...
davej Posted November 28, 2013 Share Posted November 28, 2013 How will you detect it is a mobile device? The best I can think of at the moment is to have a user display option that can be saved in a cookie. Link to comment Share on other sites More sharing options...
moonstarsun Posted March 5, 2014 Share Posted March 5, 2014 FYI loading and displaying are not the same thing. When you set display:none; the image will still consume the same bandwith because it must be physically called in browser memory even though it may not appear. For proof of concept the response time between display:block is significantly quicker than creating the image. Now to actually answer your question you can use one of a few options. My personal favorite trick is simply using a background image @media only screen and (max-device-width: 480px) { div { background-image: url('myImageUrl.png'); height: 200px; width: 400px; }}<div></div> However it can be a bit difficult to control the image ideally depending on your markup and events. Another way (slighly more dificult however much more dynamic) is to use a javascript event to create an image through the DOM. Sort of like creating a mobile display template. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now