New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

scrollama

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrollama - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

docs/scrollama.png

4

build/scrollama.js

@@ -969,3 +969,5 @@ (function (global, factory) {

} else if (!enable) {
Object.keys(observer).map(function (k) { return observer[k].disconnect(); });
Object.keys(io).map(function (k) {
if (io[k]) { io[k].disconnect(); }
});
isEnabled = false;

@@ -972,0 +974,0 @@ }

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.scrollama=e()}(this,function(){"use strict";function t(t){for(var e=t.length,n=[],o=0;o<e;o+=1)n.push(t[o]);return n}function e(t){return document.querySelector(t)}function n(e,n){return void 0===n&&(n=document),t(n.querySelectorAll(e))}return function(t,e){function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0},this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,r=o.width*o.height;this.intersectionRatio=n?r/n:this.isIntersecting?1:0}function o(t,e){var n=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(n.root&&1!=n.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=i(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(n.rootMargin),this.thresholds=this._initThresholds(n.threshold),this.root=n.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function r(){return t.performance&&performance.now&&performance.now()}function i(t,e){var n=null;return function(){n||(n=setTimeout(function(){t(),n=null},e))}}function s(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function c(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function u(t,e){var n=Math.max(t.top,e.top),o=Math.min(t.bottom,e.bottom),r=Math.max(t.left,e.left),i=Math.min(t.right,e.right),s=i-r,c=o-n;return s>=0&&c>=0&&{top:n,bottom:o,left:r,right:i,width:s,height:c}}function h(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function a(t,e){for(var n=e;n;){if(n==t)return!0;n=l(n)}return!1}function l(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e}if("IntersectionObserver"in t&&"IntersectionObserverEntry"in t&&"intersectionRatio"in t.IntersectionObserverEntry.prototype)"isIntersecting"in t.IntersectionObserverEntry.prototype||Object.defineProperty(t.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var p=[];o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},o.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(s(t,"resize",this._checkForIntersections,!0),s(e,"scroll",this._checkForIntersections,!0),"MutationObserver"in t&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,c(t,"resize",this._checkForIntersections,!0),c(e,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach(function(o){var i=o.element,s=h(i),c=this._rootContainsTarget(i),u=o.entry,a=t&&c&&this._computeTargetAndRootIntersection(i,e),l=o.entry=new n({time:r(),target:i,boundingClientRect:s,rootBounds:e,intersectionRect:a});u?t&&c?this._hasCrossedThreshold(u,l)&&this._queuedEntries.push(l):u&&u.isIntersecting&&this._queuedEntries.push(l):this._queuedEntries.push(l)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(n,o){var r=this;if("none"!=t.getComputedStyle(n).display){for(var i=h(n),s=l(n),c=!1;!c;){var a=null,p=1==s.nodeType?t.getComputedStyle(s):{};if("none"==p.display)return;if(s==r.root||s==e?(c=!0,a=o):s!=e.body&&s!=e.documentElement&&"visible"!=p.overflow&&(a=h(s)),a&&!(i=u(a,i)))break;s=l(s)}return i}},o.prototype._getRootRect=function(){var t;if(this.root)t=h(this.root);else{var n=e.documentElement,o=e.body;t={top:0,left:0,right:n.clientWidth||o.clientWidth,width:n.clientWidth||o.clientWidth,bottom:n.clientHeight||o.clientHeight,height:n.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(t)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=this,o=t&&t.isIntersecting?t.intersectionRatio||0:-1,r=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==r)for(var i=0;i<this.thresholds.length;i++){var s=n.thresholds[i];if(s==o||s==r||s<o!=s<r)return!0}},o.prototype._rootIsInDom=function(){return!this.root||a(e,this.root)},o.prototype._rootContainsTarget=function(t){return a(this.root||e,t)},o.prototype._registerInstance=function(){p.indexOf(this)<0&&p.push(this)},o.prototype._unregisterInstance=function(){var t=p.indexOf(this);-1!=t&&p.splice(t,1)},t.IntersectionObserver=o,t.IntersectionObserverEntry=n}}(window,document),function(){function t(t){var e=+t.getAttribute("data-scrollama-index"),n={direction:O,element:t,index:e};L.stepEnter&&"function"==typeof L.stepEnter&&L.stepEnter(n)}function o(t){var e=+t.getAttribute("data-scrollama-index"),n={direction:O,element:t,index:e};L.stepExit&&"function"==typeof L.stepExit&&L.stepExit(n)}function r(){var t={direction:O};L.enter&&"function"==typeof L.enter&&L.enter(t)}function i(){var t={direction:O};L.exit&&"function"==typeof L.exit&&L.exit(t)}function s(e){e.forEach(function(e){var n=e.isIntersecting,r=e.boundingClientRect,i=e.target;r.bottom-w>=0&&(O=n?"down":"up",n?t(i):o(i))})}function c(e){e.forEach(function(e){var n=e.isIntersecting,r=e.boundingClientRect,i=e.target,s=r.bottom,c=r.height,u=s-w;u>=0&&u<c&&n?(O="up",t(i)):u<=0&&!n&&(O="down",o(i))})}function u(t){var e=t[0],n=e.isIntersecting;e.boundingClientRect.bottom>0&&(O=n?"down":"up",n?r():i())}function h(t){var e=t[0],n=e.isIntersecting;e.boundingClientRect.top<0&&(O=n?"up":"down",n?r():i())}function a(){A.top&&A.top.unobserve(_);var t={root:null,rootMargin:R+"px 0px -"+R+"px 0px",threshold:0};A.top=new IntersectionObserver(u,t),A.top.observe(_)}function l(){A.bottom&&A.bottom.unobserve(_);var t={root:null,rootMargin:"-"+C.height+"px 0px "+C.height+"px 0px",threshold:0};A.bottom=new IntersectionObserver(h,t),A.bottom.observe(_)}function p(){A.stepTop&&A.stepTop.forEach(function(t){return t.disconnect()}),A.stepTop=E.map(function(t,e){var n={root:null,rootMargin:T[e]-w+"px 0px "+(-R+w)+"px 0px",threshold:0},o=new IntersectionObserver(s,n);return o.observe(t),o})}function f(){A.stepBottom&&A.stepBottom.forEach(function(t){return t.disconnect()}),A.stepBottom=E.map(function(t,e){var n={root:null,rootMargin:-w+"px 0px "+(-R+T[e]+w)+"px 0px",threshold:0},o=new IntersectionObserver(c,n);return o.observe(t),o})}function d(){p(),f(),_&&I&&(a(),l())}function g(){R=window.innerHeight,C=I?I.getBoundingClientRect():null,w=x*R,T=E?E.map(function(t){return t.getBoundingClientRect().height}):[],M&&y&&d(),k&&(document.querySelector(".scrollama__offset").style.top=w+"px")}function m(t){t&&!M?(y&&d(),M=!0):t||(Object.keys(observer).map(function(t){return observer[t].disconnect()}),M=!1)}function v(){E.forEach(function(t,e){return t.setAttribute("data-scrollama-index",e)})}function b(){if(k){var t=document.createElement("div");t.setAttribute("class","scrollama__offset"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="1px",t.style.backgroundColor="red";var e=document.createElement("p");e.innerText="scrollama trigger: "+x,e.style.fontSize="12px",e.style.fontFamily="monospace",e.style.color="red",e.style.margin="0",e.style.padding="6px",t.appendChild(e),document.body.appendChild(t)}}var y=!1,_=null,I=null,E=null,x=0,w=0,R=0,T=null,O=null,C=null,M=!1,k=!1,L={},A={},F={};return F.setup=function(t){var o=t.container,r=t.graphic,i=t.step,s=t.offset;void 0===s&&(s=.5);var c=t.debug;return void 0===c&&(c=!1),i?(E=n(i),_=o?e(o):null,I=r?e(r):null,x=s,k=c,y=!0,b(),v(),g(),m(!0)):console.error("scrollama error: missing step element"),F},F.resize=function(){return g(),F},F.enable=function(){return m(!0),F},F.disable=function(){return m(!1),F},F.onStepEnter=function(t){return L.stepEnter=t,F},F.onStepExit=function(t){return L.stepExit=t,F},F.onIncrement=function(t){return L.increment=t,F},F.onContainerEnter=function(t){return L.enter=t,F},F.onContainerExit=function(t){return L.exit=t,F},F}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.scrollama=e()}(this,function(){"use strict";function t(t){for(var e=t.length,n=[],o=0;o<e;o+=1)n.push(t[o]);return n}function e(t){return document.querySelector(t)}function n(e,n){return void 0===n&&(n=document),t(n.querySelectorAll(e))}return function(t,e){function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0},this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,r=o.width*o.height;this.intersectionRatio=n?r/n:this.isIntersecting?1:0}function o(t,e){var n=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(n.root&&1!=n.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=i(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(n.rootMargin),this.thresholds=this._initThresholds(n.threshold),this.root=n.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function r(){return t.performance&&performance.now&&performance.now()}function i(t,e){var n=null;return function(){n||(n=setTimeout(function(){t(),n=null},e))}}function s(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function c(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function u(t,e){var n=Math.max(t.top,e.top),o=Math.min(t.bottom,e.bottom),r=Math.max(t.left,e.left),i=Math.min(t.right,e.right),s=i-r,c=o-n;return s>=0&&c>=0&&{top:n,bottom:o,left:r,right:i,width:s,height:c}}function h(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function a(t,e){for(var n=e;n;){if(n==t)return!0;n=l(n)}return!1}function l(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e}if("IntersectionObserver"in t&&"IntersectionObserverEntry"in t&&"intersectionRatio"in t.IntersectionObserverEntry.prototype)"isIntersecting"in t.IntersectionObserverEntry.prototype||Object.defineProperty(t.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var p=[];o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},o.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(s(t,"resize",this._checkForIntersections,!0),s(e,"scroll",this._checkForIntersections,!0),"MutationObserver"in t&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,c(t,"resize",this._checkForIntersections,!0),c(e,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach(function(o){var i=o.element,s=h(i),c=this._rootContainsTarget(i),u=o.entry,a=t&&c&&this._computeTargetAndRootIntersection(i,e),l=o.entry=new n({time:r(),target:i,boundingClientRect:s,rootBounds:e,intersectionRect:a});u?t&&c?this._hasCrossedThreshold(u,l)&&this._queuedEntries.push(l):u&&u.isIntersecting&&this._queuedEntries.push(l):this._queuedEntries.push(l)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(n,o){var r=this;if("none"!=t.getComputedStyle(n).display){for(var i=h(n),s=l(n),c=!1;!c;){var a=null,p=1==s.nodeType?t.getComputedStyle(s):{};if("none"==p.display)return;if(s==r.root||s==e?(c=!0,a=o):s!=e.body&&s!=e.documentElement&&"visible"!=p.overflow&&(a=h(s)),a&&!(i=u(a,i)))break;s=l(s)}return i}},o.prototype._getRootRect=function(){var t;if(this.root)t=h(this.root);else{var n=e.documentElement,o=e.body;t={top:0,left:0,right:n.clientWidth||o.clientWidth,width:n.clientWidth||o.clientWidth,bottom:n.clientHeight||o.clientHeight,height:n.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(t)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=this,o=t&&t.isIntersecting?t.intersectionRatio||0:-1,r=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==r)for(var i=0;i<this.thresholds.length;i++){var s=n.thresholds[i];if(s==o||s==r||s<o!=s<r)return!0}},o.prototype._rootIsInDom=function(){return!this.root||a(e,this.root)},o.prototype._rootContainsTarget=function(t){return a(this.root||e,t)},o.prototype._registerInstance=function(){p.indexOf(this)<0&&p.push(this)},o.prototype._unregisterInstance=function(){var t=p.indexOf(this);-1!=t&&p.splice(t,1)},t.IntersectionObserver=o,t.IntersectionObserverEntry=n}}(window,document),function(){function t(t){var e=+t.getAttribute("data-scrollama-index"),n={direction:O,element:t,index:e};L.stepEnter&&"function"==typeof L.stepEnter&&L.stepEnter(n)}function o(t){var e=+t.getAttribute("data-scrollama-index"),n={direction:O,element:t,index:e};L.stepExit&&"function"==typeof L.stepExit&&L.stepExit(n)}function r(){var t={direction:O};L.enter&&"function"==typeof L.enter&&L.enter(t)}function i(){var t={direction:O};L.exit&&"function"==typeof L.exit&&L.exit(t)}function s(e){e.forEach(function(e){var n=e.isIntersecting,r=e.boundingClientRect,i=e.target;r.bottom-w>=0&&(O=n?"down":"up",n?t(i):o(i))})}function c(e){e.forEach(function(e){var n=e.isIntersecting,r=e.boundingClientRect,i=e.target,s=r.bottom,c=r.height,u=s-w;u>=0&&u<c&&n?(O="up",t(i)):u<=0&&!n&&(O="down",o(i))})}function u(t){var e=t[0],n=e.isIntersecting;e.boundingClientRect.bottom>0&&(O=n?"down":"up",n?r():i())}function h(t){var e=t[0],n=e.isIntersecting;e.boundingClientRect.top<0&&(O=n?"up":"down",n?r():i())}function a(){A.top&&A.top.unobserve(_);var t={root:null,rootMargin:R+"px 0px -"+R+"px 0px",threshold:0};A.top=new IntersectionObserver(u,t),A.top.observe(_)}function l(){A.bottom&&A.bottom.unobserve(_);var t={root:null,rootMargin:"-"+C.height+"px 0px "+C.height+"px 0px",threshold:0};A.bottom=new IntersectionObserver(h,t),A.bottom.observe(_)}function p(){A.stepTop&&A.stepTop.forEach(function(t){return t.disconnect()}),A.stepTop=E.map(function(t,e){var n={root:null,rootMargin:T[e]-w+"px 0px "+(-R+w)+"px 0px",threshold:0},o=new IntersectionObserver(s,n);return o.observe(t),o})}function f(){A.stepBottom&&A.stepBottom.forEach(function(t){return t.disconnect()}),A.stepBottom=E.map(function(t,e){var n={root:null,rootMargin:-w+"px 0px "+(-R+T[e]+w)+"px 0px",threshold:0},o=new IntersectionObserver(c,n);return o.observe(t),o})}function d(){p(),f(),_&&I&&(a(),l())}function g(){R=window.innerHeight,C=I?I.getBoundingClientRect():null,w=x*R,T=E?E.map(function(t){return t.getBoundingClientRect().height}):[],M&&y&&d(),k&&(document.querySelector(".scrollama__offset").style.top=w+"px")}function m(t){t&&!M?(y&&d(),M=!0):t||(Object.keys(A).map(function(t){A[t]&&A[t].disconnect()}),M=!1)}function v(){E.forEach(function(t,e){return t.setAttribute("data-scrollama-index",e)})}function b(){if(k){var t=document.createElement("div");t.setAttribute("class","scrollama__offset"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="1px",t.style.backgroundColor="red";var e=document.createElement("p");e.innerText="scrollama trigger: "+x,e.style.fontSize="12px",e.style.fontFamily="monospace",e.style.color="red",e.style.margin="0",e.style.padding="6px",t.appendChild(e),document.body.appendChild(t)}}var y=!1,_=null,I=null,E=null,x=0,w=0,R=0,T=null,O=null,C=null,M=!1,k=!1,L={},A={},F={};return F.setup=function(t){var o=t.container,r=t.graphic,i=t.step,s=t.offset;void 0===s&&(s=.5);var c=t.debug;return void 0===c&&(c=!1),i?(E=n(i),_=o?e(o):null,I=r?e(r):null,x=s,k=c,y=!0,b(),v(),g(),m(!0)):console.error("scrollama error: missing step element"),F},F.resize=function(){return g(),F},F.enable=function(){return m(!0),F},F.disable=function(){return m(!1),F},F.onStepEnter=function(t){return L.stepEnter=t,F},F.onStepExit=function(t){return L.stepExit=t,F},F.onIncrement=function(t){return L.increment=t,F},F.onContainerEnter=function(t){return L.enter=t,F},F.onContainerExit=function(t){return L.exit=t,F},F}});

@@ -969,3 +969,5 @@ (function (global, factory) {

} else if (!enable) {
Object.keys(observer).map(function (k) { return observer[k].disconnect(); });
Object.keys(io).map(function (k) {
if (io[k]) { io[k].disconnect(); }
});
isEnabled = false;

@@ -972,0 +974,0 @@ }

{
"name": "scrollama",
"version": "0.4.1",
"version": "0.4.2",
"description": "Lightweight scrollytelling library using IntersectionObserver",

@@ -5,0 +5,0 @@ "main": "build/scrollama.js",

@@ -52,5 +52,5 @@ # scrollama.js

scroller.setup({
step: '.step', // required
offset: 0.5, // optional, default = 0.5
debug: false, // optional, default = false
step: '.step', // required
offset: 0.5, // optional, default = 0.5
debug: false, // optional, default = false
})

@@ -67,6 +67,8 @@ .onStepEnter(handleStepEnter)

<div class='scroll'>
<!-- graphic = ".scroll__graphic" -->
<div class='scroll__graphic'><!--graphic / chart code here--></div>
<!-- graphic = ".scroll__graphic" -->
<div class='scroll__graphic'>
<!--graphic / chart code here-->
</div>
<div class='scroll__text'>
<!-- steps = ".step" -->
<!-- steps = ".step" -->
<div class='step' data-step='a'></div>

@@ -85,7 +87,7 @@ <div class='step' data-step='b'></div>

scroller.setup({
step: '.scroll__text .step', // required
container: '.scroll', // required (for sticky)
step: '.scroll__text .step', // required
container: '.scroll', // required (for sticky)
graphic: '.scroll__graphic', // required (for sticky)
offset: 0.5, // optional, default = 0.5
debug: false, // optional, default = false
offset: 0.5, // optional, default = 0.5
debug: false, // optional, default = false
})

@@ -169,4 +171,4 @@ .onStepEnter(handleStepEnter)

[Basic](https://russellgoldenberg.github.io/scrollama/basic) - just step triggers
[Sticky Graphic](https://russellgoldenberg.github.io/scrollama/sticky-graphic) - basic implentation of sticky graphic (tk)
* [Basic](https://russellgoldenberg.github.io/scrollama/basic) - just step triggers
* [Sticky Graphic](https://russellgoldenberg.github.io/scrollama/sticky-graphic) - basic implentation of sticky graphic

@@ -173,0 +175,0 @@ ### To do

@@ -220,3 +220,5 @@ import { select, selectAll } from "./dom";

} else if (!enable) {
Object.keys(observer).map(k => observer[k].disconnect());
Object.keys(io).map(k => {
if (io[k]) io[k].disconnect();
});
isEnabled = false;

@@ -223,0 +225,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc