Skip to content

Instantly share code, notes, and snippets.

View jdsharp's full-sized avatar

Jonathan Sharp jdsharp

  • Northern Wisconsin
View GitHub Profile
@jdsharp
jdsharp / lazy-load-hooks.js
Created April 21, 2015 19:58
Hooks for lazy loading images
window.isCloseToViewport = function(node, howClose) {
if ( !node ) {
return false;
}
var factor = howClose;
if ( !factor ) {
factor = 1;
}
var doc = node && node.ownerDocument && node.ownerDocument.documentElement;
@jdsharp
jdsharp / sample.js
Created November 11, 2016 16:17
React Unmanaged DOM Node Wrapping
const UnmanagedDOMContainer = React.createClass({
getDefaultProps() {
return {
nodes : null
};
},
componentWillReceiveProps(newProps) {
if ( !this.props.nodes && newProps.nodes ) {
this.appendNodes(newProps.nodes);