Skip to content

Instantly share code, notes, and snippets.

@anthony-dandrea
Created May 26, 2015 20:37
Show Gist options
  • Save anthony-dandrea/fb7f458151511c6afcd5 to your computer and use it in GitHub Desktop.
Save anthony-dandrea/fb7f458151511c6afcd5 to your computer and use it in GitHub Desktop.
Picturefill

I pretty much just followed the directions here - http://scottjehl.github.io/picturefill/ In my markup I have something like:

  <html>
    <head>
      <script src="scripts/vendor/picturefill.min.js"></script>
    </head>
    <body>
      <picture>
				<!--[if IE 9]><video style="display: none;"><![endif]-->
				<source srcset="images/desktop-size.png" media="(min-width: 640px)">
				<!--[if IE 9]></video><![endif]-->
				<img class="app-layer-img" srcset="images/mobile-size.png">
			</picture>
    </body>
  </html>

Note: IE9 is dumb which is why those silly IE conditionals are there =-[

@DLavin23
Copy link

  <picture>
    <source srcset="http://placehold.it/1200x600" media="(min-width: 1000px)">
    <source srcset="http://placehold.it/800x600" media="(min-width: 800px)">
    <img srcset="/path-to-my-image" alt="Loyalty">    
  </picture>

@DLavin23
Copy link

for whatever reason I can't get my local images to load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment