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

sponlax

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sponlax - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

2

dist/index.min.js

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.sponlax=n()}(this,function(){"use strict";var t=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},n=function(){var t=this;this.defaults={rootMargin:"0px",threshold:0,shouldUnObserve:function(){return!1},observerLoop:function(t){var n=t.$node,e=n.getBoundingClientRect().top,r=n.dataset.speed;n.style.transform="translate3d(0, "+e*parseFloat(r)+"px, 0)"}},this.within=function(t){return"true"===t.getAttribute("data-inview")},this.markAsWithin=function(t){return t.setAttribute("data-inview","true")},this.markAsNotWithin=function(t){return t.setAttribute("data-inview","false")},this.loop=function(){var n=t.options.observerLoop;t.blobs.forEach(n),t.handle=requestAnimationFrame(t.loop)},this.onIntersection=function(){return function(n,e){var r=t.options.shouldUnObserve;n.forEach(function(n){var o=n.target;n.isIntersecting?(r(o)&&e.unobserve(o),t.within(o)||t.markAsWithin(o)):t.within(o)&&t.markAsNotWithin(o),t.blobs=t.nodes.filter(t.within).map(function(t){return{$node:t,entry:n}})}),t.blobs.length>0&&null===t.handle&&t.loop(),0===t.blobs.length&&(cancelAnimationFrame(t.handle),t.handle=null)}}};return function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"[data-inview]",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),n.call(this),this.nodes=[].concat(function(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}(document.querySelectorAll(r))).map(function(t,n){return t.setAttribute("data-key",n),t}),this.options=t({},this.defaults,o);var i=this.options,s=i.rootMargin,a=i.threshold,u=new IntersectionObserver(this.onIntersection(),{rootMargin:s,threshold:a});this.nodes.forEach(function(t){return u.observe(t)}),this.blobs=[],this.handle=null}});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.sponlax=n()}(this,function(){"use strict";var t=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},n=function(){var t=this;this.defaults={rootMargin:"0px",threshold:0,shouldUnObserve:function(){return!1},inview:function(t){var n=t.$node,e=n.getBoundingClientRect().top,r=n.dataset.speed;n.style.transform="translate3d(0, "+e*parseFloat(r)+"px, 0)"}},this.prevFrame=-1,this.within=function(t){return"true"===t.getAttribute("data-inview")},this.markAsWithin=function(t){return t.setAttribute("data-inview","true")},this.markAsNotWithin=function(t){return t.setAttribute("data-inview","false")},this.loop=function(){var n=t.options.inview;window.pageYOffset!==t.prevFrame?(t.prevFrame=window.pageYOffset,t.blobs.forEach(n),t.handle=requestAnimationFrame(t.loop)):t.handle=requestAnimationFrame(t.loop)},this.onIntersection=function(){return function(n,e){var r=t.options.shouldUnObserve;n.forEach(function(n){var i=n.target;n.isIntersecting?(r(i)&&e.unobserve(i),t.within(i)||t.markAsWithin(i)):t.within(i)&&t.markAsNotWithin(i),t.blobs=t.nodes.filter(t.within).map(function(t){return{$node:t,entry:n}})}),t.blobs.length>0&&null===t.handle&&t.loop(),0===t.blobs.length&&(cancelAnimationFrame(t.handle),t.handle=null)}}};return function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"[data-inview]",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),n.call(this),this.nodes=[].concat(function(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}(document.querySelectorAll(r))).map(function(t,n){return t.setAttribute("data-key",n),t}),this.options=t({},this.defaults,i);var o=this.options,a=o.rootMargin,s=o.threshold,u=new IntersectionObserver(this.onIntersection(),{rootMargin:a,threshold:s});this.nodes.forEach(function(t){return u.observe(t)}),this.blobs=[],this.handle=null}});
{
"name": "sponlax",
"version": "0.0.1",
"main": "dist/index.min.js",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.0",
"rollup": "^0.46.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-uglify": "^2.0.1"
},
"scripts": {
"build": "rollup -c",
"dev": "NODE_ENV=development rollup -c -w"
},
"files": [
"dist"
],
"description": "Intersection Observer + raf... parallax?!",
"repository": {
"type": "git",
"url": "git+https://github.com/magicspon/sponlax.git"
},
"author": "Dave Stockley",
"license": "MIT",
"bugs": {
"url": "https://github.com/magicspon/sponlax/issues"
},
"homepage": "https://github.com/magicspon/sponlax#readme",
"dependencies": {}
"name": "sponlax",
"version": "0.1.0",
"main": "dist/index.min.js",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.0",
"rollup": "^0.46.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-uglify": "^2.0.1"
},
"scripts": {
"build": "rollup -c",
"dev": "NODE_ENV=development rollup -c -w"
},
"files": ["dist"],
"description": "Intersection Observer + raf... parallax?!",
"repository": {
"type": "git",
"url": "git+https://github.com/magicspon/sponlax.git"
},
"author": "Dave Stockley",
"license": "MIT",
"bugs": {
"url": "https://github.com/magicspon/sponlax/issues"
},
"homepage": "https://github.com/magicspon/sponlax#readme",
"dependencies": {}
}

@@ -17,3 +17,3 @@ # do stuff when shit's in the view

new SponLax('[data-item]', {
observerLoop({ $node }) {
inview({ $node }) {
const { top } = $node.getBoundingClientRect()

@@ -20,0 +20,0 @@ const { speed } = $node.dataset

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