Last active
September 17, 2015 23:10
-
-
Save aalexeev239/18932c97263c0edfc7cc to your computer and use it in GitHub Desktop.
prevent image loading for mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--The idea is to load base64-encoded 1px transparent gif for some media queries--> | |
<picture> | |
<source media="(max-width: 759px)" srcset="data:image/gifbase64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="> | |
<img src="image.png" srcset="[email protected] 2x, [email protected] 3x" height="100" width="100" alt="image"> | |
</picture> | |
<picture> | |
<source srcset="{{img}}" media="(min-width: 768px)" /> | |
<img srcset="data:image/gifbase64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="{{title}}" width="110" height="110" /> | |
</picture> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment