Comparing version 0.0.8 to 0.0.9
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(this,function(){"use strict";function t(t,n,i){var o=function(t){setTimeout(function(){t.classList.add(n)},i)};return t.length?Array.from(t,function(t){o(t)}):o(e),this}exports.lazy=t});!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(this,function(){"use strict";function t(t,n,e){var i=function(t){setTimeout(function(){t.classList.add(n)},e)};return t.length?Array.from(t,function(t){i(t)}):i(t),this}exports.lazy=t}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";function e(e,t,n){var o=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],i=o.change||"add",s=function(e){switch(i){case"add":e.classList.add(t);break;case"remove":e.classList.remove(t);break;case"toggle":e.classList.toggle(t);break;default:console.log("invalid value for change option specified")}},a=function(e){setTimeout(function(){s(e)},n)};return e.length?Array.from(e,function(e){a(e)}):a(e),this}exports.lazy=e}); |
{ | ||
"name": "bradpitt", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Set of javascript modules that do cool stuff", | ||
@@ -5,0 +5,0 @@ "main": "dist/bradpitt.min.js", |
@@ -7,8 +7,25 @@ | ||
* @param {string} className long to wait for a response | ||
* @param {number} iming in milliseconds | ||
* @param {number} timing in milliseconds | ||
* @param {options} options object | ||
*/ | ||
function lazy(el, className, timing) { | ||
function lazy(el, className, timing, options = {}) { | ||
let change = options.change || 'add' | ||
let classSwap = (e) => { | ||
switch(change) { | ||
case 'add': | ||
e.classList.add(className) | ||
break | ||
case 'remove': | ||
e.classList.remove(className) | ||
break | ||
case 'toggle': | ||
e.classList.toggle(className) | ||
break | ||
default: | ||
console.log('invalid value for change option specified') | ||
} | ||
} | ||
let sT = (e) => { | ||
setTimeout(() => { e.classList.add(className) }, timing) | ||
setTimeout(() => { classSwap(e) }, timing) | ||
} | ||
@@ -15,0 +32,0 @@ el.length ? Array.from(el, (e) => { sT(e) }) : sT(el) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11608
128