diff --git a/.gitignore b/.gitignore index d0ab703..183b647 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ node_modules .gh-pages +.idea +.DS_STORE +npm-debug.log diff --git a/dist/appear.js b/dist/appear.js index 9c8931b..4bca352 100644 --- a/dist/appear.js +++ b/dist/appear.js @@ -1,5 +1,5 @@ /* appear.js 1.1.0 */ -appear = (function(){ +(function(window){ 'use strict'; var scrollLastPos = null, scrollTimer = 0, scroll = {}; @@ -173,7 +173,7 @@ appear = (function(){ } } - return function(obj) { + var appear = function(obj) { obj = obj || {}; // assign the fn to execute when a node is visible @@ -244,6 +244,12 @@ appear = (function(){ }; }; + + if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = appear; + } else { + window.appear = appear; + } }()(obj)); }; -}()); +}(this)); diff --git a/dist/appear.min.js b/dist/appear.min.js index 3cb74b3..a6055d4 100644 --- a/dist/appear.min.js +++ b/dist/appear.min.js @@ -1,2 +1,2 @@ /* appear.min.js 1.1.0 */ -appear=function(){"use strict";function e(){var e=window.scrollY||window.pageYOffset;null!=n&&(o.velocity=e-n,o.delta=o.velocity>=0?o.velocity:-1*o.velocity),n=e,i&&clearTimeout(i),i=setTimeout(function(){n=null},30)}function t(e,t){var n=e.getBoundingClientRect();return n.top+n.height>=0&&n.left+n.width>=0&&n.bottom-n.height<=(window.innerHeight||document.documentElement.clientHeight)+t&&n.right-n.width<=(window.innerWidth||document.documentElement.clientWidth)+t}var n=null,i=0,o={};return addEventListener("scroll",e,!1),function(e){return function(e){function n(e,t){return function(){var n=this,i=arguments;clearTimeout(l),l=setTimeout(function(){e.apply(n,i)},t)}}function i(){o.delta=0?r.velocity:-1*r.velocity),i=t,o&&clearTimeout(o),o=setTimeout(function(){i=null},30)}function n(t,n){var i=t.getBoundingClientRect();return i.top+i.height>=0&&i.left+i.width>=0&&i.bottom-i.height<=(e.innerHeight||document.documentElement.clientHeight)+n&&i.right-i.width<=(e.innerWidth||document.documentElement.clientWidth)+n}var i=null,o=0,r={};return addEventListener("scroll",t,!1),function(t){return function(t){function i(e,t){return function(){var n=this,i=arguments;clearTimeout(s),s=setTimeout(function(){e.apply(n,i)},t)}}function o(){r.delta