Skip to content

Instantly share code, notes, and snippets.

@PhilippSoehnlein
PhilippSoehnlein / demo.js
Created Aug 20, 2017
Lazy loading images with Intersection Observer
View demo.js
/**
* A simple demo on how the new Intersection Observer API can be used to lazy load images.
* https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
*
* Intersection Observer is available in most modern browsers and there's a decent polyfill, too:
* https://github.com/WICG/IntersectionObserver/tree/gh-pages/polyfill
*/
let imageNodes = [];
@PhilippSoehnlein
PhilippSoehnlein / modernizr-test_position_fixed_ios.js
Created Nov 3, 2011
Modernizr Test for position fixed (including iOS tests)
View modernizr-test_position_fixed_ios.js
/* modernizr-test_position_fixed_ios.js
* Original by Daniel Ott (https://gist.github.com/1333800)
* 3 March 2011
* Updated by Philipp Söhnlein 3 November 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.