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
(function () { | |
var | |
documentElement = document.documentElement, | |
viewportFontSize, viewportHeight, viewportIsPortrait, viewportMax, viewportMin, viewportWidth; | |
function getViewportFontSize() { | |
var | |
body = documentElement.appendChild(document.createElement('body')), | |
iframe = document.createElement('iframe'), | |
iframeDocument; |
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
<!DOCTYPE html> | |
<html> | |
<head lang="en"> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script> | |
var onreadys = function(){ | |
console.log(document.readyState); | |
console.log(document.body); |
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
var timer; | |
var run = function(){ | |
runpictureFill(); | |
if(document.readyState == 'complete'){ | |
clearInterval(timer); | |
} | |
}; | |
timer = setInterval(run, 250); | |
setTimeout(run, document.body ? 9 : 99); |
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
<img src="logo.png" srcset="logo2x.png 200w, logo3x.png 300w" /> |
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
<!-- if you have 3dpr choose logo3x.png --> | |
<img src="logo.png" srcset="logo2x.png 200w, logo3x.png 300w" sizes="100px" /> | |
<!-- | |
if you have 3dpr and sizes computes to 100px choose img2.jpg | |
but if you have 2dpr and sizes computes to 150px take img3.jpg | |
--> | |
<img src="img.jpg" srcset="img2.jpg 200w, img3.jpg 300w" maxdpr="2" sizes="100px" /> |
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
<!- | |
2x device and viewport 1000px: 2000.jpg (i.e.: 2dpr res) | |
3x device and viewport 1000px: 2000.jpg (i.e.: 2dpr res) <- constrained | |
3x device and viewport 1500px: 3000.jpg (i.e.: 2dpr res) <- constrained | |
-> | |
<img srcset="500.jpg 500w, 1000.jpg 1000w, 1500.jpg 1500w, 2000.jpg 2000w, 3000jpg 3000w, 4000jpg 4000w" maxdpr="2" sizes="100vw" /> |
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
<picture> | |
<!--[if IE 9]><video style="display: none;"><![endif]--> | |
<source srcset="runner-wide.jpg" media="(min-width: 1000px)" /> | |
<source srcset="runner-narrow.jpg" media="(min-width: 600px)" /> | |
<!--[if IE 9]></video><![endif]--> | |
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
(function(){ | |
'use strict'; | |
var width2 = 'data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw=='; | |
var width1 = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='; | |
var img = document.createElement('img'); | |
var test = function(){ | |
var width = img.width; | |
if(width == 2){ | |
alert('your browser support sizes'); |
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
/* | |
asyncReady('jQuery', function(fn){ | |
console.log('jQuery found', fn) | |
}); | |
asyncReady('jQuery.ui', function(fn){ | |
console.log('jQuery found', fn) | |
}); | |
*/ | |
window.asyncReady = (function(){ | |
var readys = {}; |
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
/*! Picturefill - v3.0.2 - 2016-02-02 | |
* http://scottjehl.github.io/picturefill | |
* Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT | |
*/ | |
!function(a){var b=navigator.userAgent;a.HTMLPictureElement&&/ecko/.test(b)&&b.match(/rv\:(\d+)/)&&RegExp.$1<45&&addEventListener("resize",function(){var b,c=document.createElement("source"),d=function(a){var b,d,e=a.parentNode;"PICTURE"===e.nodeName.toUpperCase()?(b=c.cloneNode(),e.insertBefore(b,e.firstElementChild),setTimeout(function(){e.removeChild(b)})):(!a._pfLastSize||a.offsetWidth>a._pfLastSize)&&(a._pfLastSize=a.offsetWidth,d=a.sizes,a.sizes+=",100vw",setTimeout(function(){a.sizes=d}))},e=function(){var a,b=document.querySelectorAll("picture > img, img[srcset][sizes]");for(a=0;a<b.length;a++)d(b[a])},f=function(){clearTimeout(b),b=setTimeout(e,99)},g=a.matchMedia&&matchMedia("(orientation: landscape)"),h=function(){f(),g&&g.addListener&&g.addListener(f)};return c.srcset="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKA |
OlderNewer