forked from scottjehl/picturefill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This pull request adds demo pages for each distinct code sample. This allows users to see the effect of resizing the window on the photo without large quantities of text pushing the image off the page.
- Loading branch information
1 parent
cdc1fba
commit 43388ae
Showing
6 changed files
with
330 additions
and
146 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=utf-8 /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>Picturefill - Demo</title> | ||
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> | ||
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400' rel='stylesheet' type='text/css'> | ||
<link href='src/styles.css' rel='stylesheet' type='text/css'> | ||
|
||
<script> | ||
// Picture element HTML shim|v it for old IE (pairs with Picturefill.js) | ||
document.createElement( "picture" ); | ||
</script> | ||
<script async="true" src="dist/picturefill.js"></script> | ||
</head> | ||
<body> | ||
<a href="http://responsiveimages.org/" class="ricg"><img src="https://raw.github.com/ResponsiveImagesCG/meta/master/logo/Web/RICG_logo_small.png"></a> | ||
|
||
|
||
|
||
<h3>An img with "srcset" and sizes" attributes:</h3> | ||
<pre><code><img sizes="(max-width: 30em) 100%, (max-width: 50em) 75%, 50%" | ||
srcset="examples/images/pic-small.png 400w, examples/images/pic-medium.png 800w, examples/images/pic-large.png 1200w" alt="Obama with soldiers"> | ||
</code></pre> | ||
|
||
<p>Here's how that renders in the browser. Feel free to resize to see it change.</p> | ||
|
||
<img sizes="(max-width: 30em) 100%, (max-width: 50em) 75%, 50%" | ||
srcset="examples/images/pic-small.png 400w, examples/images/pic-medium.png 800w, examples/images/pic-large.png 1200w" alt="Obama with soldiers"> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=utf-8 /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>Picturefill - Demo</title> | ||
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> | ||
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400' rel='stylesheet' type='text/css'> | ||
<link href='src/styles.css' rel='stylesheet' type='text/css'> | ||
|
||
<script> | ||
// Picture element HTML shim|v it for old IE (pairs with Picturefill.js) | ||
document.createElement( "picture" ); | ||
</script> | ||
<script async="true" src="dist/picturefill.js"></script> | ||
</head> | ||
<body> | ||
<a href="http://responsiveimages.org/" class="ricg"><img src="https://raw.github.com/ResponsiveImagesCG/meta/master/logo/Web/RICG_logo_small.png"></a> | ||
|
||
|
||
|
||
<h3>Supporting Picture in Internet Explorer 9</h3> | ||
<p>While most versions of IE (even older ones!) are supported well, IE9 has a little conflict to work around. To support IE9, you will need to wrap a <code>video</code> element wrapper around the source elements in your <code>picture</code> tag. You can do this using conditional comments, like so:</p> | ||
|
||
<pre><code><picture> | ||
<!--[if IE 9]><video style="display: none;"><![endif]--> | ||
<source srcset="examples/images/extralarge.jpg" media="(min-width: 1000px)"> | ||
<source srcset="examples/images/large.jpg" media="(min-width: 800px)"> | ||
<source srcset="examples/images/medium.jpg"> | ||
<!--[if IE 9]></video><![endif]--> | ||
<img srcset="examples/images/medium.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> | ||
</picture> | ||
</code></pre> | ||
|
||
<p>Here's how that renders in the browser. Feel free to resize to see it change.</p> | ||
|
||
<picture> | ||
<!--[if IE 9]><video style="display: none;"><![endif]--> | ||
<source srcset="examples/images/extralarge.jpg" media="(min-width: 1000px)"> | ||
<source srcset="examples/images/large.jpg" media="(min-width: 800px)"> | ||
<source srcset="examples/images/medium.jpg"> | ||
<!--[if IE 9]></video><![endif]--> | ||
<img srcset="examples/images/medium.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> | ||
</picture> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=utf-8 /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>Picturefill - Demo</title> | ||
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> | ||
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400' rel='stylesheet' type='text/css'> | ||
<link href='src/styles.css' rel='stylesheet' type='text/css'> | ||
|
||
<script> | ||
// Picture element HTML shim|v it for old IE (pairs with Picturefill.js) | ||
document.createElement( "picture" ); | ||
</script> | ||
<script async="true" src="dist/picturefill.js"></script> | ||
</head> | ||
<body> | ||
<a href="http://responsiveimages.org/" class="ricg"><img src="https://raw.github.com/ResponsiveImagesCG/meta/master/logo/Web/RICG_logo_small.png"></a> | ||
|
||
|
||
|
||
<h3><code>media</code> and <code>srcset</code> syntax:</h3> | ||
<p>The <code>1x</code>, <code>2x</code> syntax in <code>srcset</code> acts as a shorthand for more complex resolution media queries. When natively supported, <code>srcset</code> will allow the UA to override requests for higher-resolution options based on a bandwidth limitations or a user preference (see #9 in the <a href="http://usecases.responsiveimages.org/#h2_requirements">Responsive Images Use Cases and Requirements</a>).</p> | ||
|
||
<pre><code><picture> | ||
<!--[if IE 9]><video style="display: none;"><![endif]--> | ||
<source srcset="examples/images/large.jpg, examples/images/extralarge.jpg 2x" media="(min-width: 800px)"> | ||
<source srcset="examples/images/small.jpg, examples/images/medium.jpg 2x"> | ||
<!--[if IE 9]></video><![endif]--> | ||
<img srcset="examples/images/small.jpg, examples/images/medium.jpg 2x" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> | ||
</picture> | ||
</code></pre> | ||
|
||
<picture> | ||
<!--[if IE 9]><video style="display: none;"><![endif]--> | ||
<source srcset="examples/images/large.jpg, examples/images/extralarge.jpg 2x" media="(min-width: 800px)"> | ||
<source srcset="examples/images/small.jpg, examples/images/medium.jpg 2x"> | ||
<!--[if IE 9]></video><![endif]--> | ||
<img srcset="examples/images/small.jpg, examples/images/medium.jpg 2x" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> | ||
</picture> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=utf-8 /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>Picturefill - Demo</title> | ||
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> | ||
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400' rel='stylesheet' type='text/css'> | ||
<link href='src/styles.css' rel='stylesheet' type='text/css'> | ||
|
||
<script> | ||
// Picture element HTML shim|v it for old IE (pairs with Picturefill.js) | ||
document.createElement( "picture" ); | ||
</script> | ||
<script async="true" src="dist/picturefill.js"></script> | ||
</head> | ||
<body> | ||
<a href="http://responsiveimages.org/" class="ricg"><img src="https://raw.github.com/ResponsiveImagesCG/meta/master/logo/Web/RICG_logo_small.png"></a> | ||
|
||
|
||
|
||
<h3><code>media</code> example with one webp source qualified with a <code>type</code> attribute.</h3> | ||
<p>Note: Picturefill supports SVG and WebP types on any source element, and will disregard a <code>source</code> if its type is not supported in a particular environment:</p> | ||
|
||
<pre><code><picture> | ||
<!--[if IE 9]><video style="display: none;"><![endif]--> | ||
<source srcset="examples/images/large.webp" media="(min-width: 800px)" type="image/webp"> | ||
<source srcset="examples/images/large.jpg" media="(min-width: 800px)"> | ||
<source srcset="examples/images/medium.jpg" media="(min-width: 400px)"> | ||
<!--[if IE 9]></video><![endif]--> | ||
<img srcset="examples/images/small.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> | ||
</picture> | ||
</code></pre> | ||
|
||
<picture> | ||
<!--[if IE 9]><video style="display: none;"><![endif]--> | ||
<source srcset="examples/images/large.webp" media="(min-width: 800px)" type="image/webp"> | ||
<source srcset="examples/images/large.jpg" media="(min-width: 800px)"> | ||
<source srcset="examples/images/medium.jpg" media="(min-width: 400px)"> | ||
<!--[if IE 9]></video><![endif]--> | ||
<img srcset="examples/images/small.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> | ||
</picture> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains 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
Oops, something went wrong.