diff --git a/dist/iconate.min.js b/dist/iconate.min.js index a2c6ffa..5ad7479 100644 --- a/dist/iconate.min.js +++ b/dist/iconate.min.js @@ -1,3 +1,4 @@ /*! iconate.js - v0.2.7 - 2018-01-16 * http://bitshadow.github.io/iconate -* Copyright (c) 2018 Jignesh Kakadiya;!function(){"use strict";var t,n,e,o=600,i=1e3,a="zoomOut",r=void 0!==(e=document.documentElement.style).animation||void 0!==e.webkitAnimation;n=void 0===window.onanimationend&&void 0!==window.onwebkitanimationend?"webkitAnimationEnd":"animationend",t=void 0===window.onanimationstart&&void 0!==window.onwebkitanimationstart?"webkitAnimationStart":"animationstart";var m=Date.now||function(){return(new Date).getTime()};function s(t,n,e){t.classList.contains(n)&&t.classList.remove(n),t.classList.add(e)}function d(e,d,w){var u,v,c,f,y,l;if(!e)throw new Error('Iconate > "element" is required');if(!r)return s(e,d.from,d.to),void("function"==typeof w&&w());function p(){var t=m(),n=u/2;v=window.setTimeout(function(){m()-t>=n&&s(e,d.from,d.to)},n)}c=(d=d||{}).animation||a,u=d.duration||o,e.addEventListener(t,p,!1),e.addEventListener(n,function o(){var i;window.clearTimeout(v),(i=e).style.removeProperty("-webkit-animation"),i.style.removeProperty("animation"),i.style.removeProperty("-moz-animation"),i.style.removeProperty("-o-animation"),e.removeEventListener(n,o),e.removeEventListener(t,p),"function"==typeof w&&w()},!1),y=c,l=u/i,(f=e).style.setProperty("-webkit-animation",y+" "+l+"s"),f.style.setProperty("animation",y+" "+l+"s"),f.style.setProperty("-moz-animation",y+" "+l+"s"),f.style.setProperty("-o-animation",y+" "+l+"s")}"object"==typeof exports?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):window.iconate=d}(); \ No newline at end of file +* Copyright (c) 2018 Jignesh Kakadiya;!function(){"use strict";var t,n,e,o=600,i=1e3,a="zoomOut",r=void 0!==(e=document.documentElement.style).animation||void 0!==e.webkitAnimation;n=void 0===window.onanimationend&&void 0!==window.onwebkitanimationend?"webkitAnimationEnd":"animationend",t=void 0===window.onanimationstart&&void 0!==window.onwebkitanimationstart?"webkitAnimationStart":"animationstart";var m=Date.now||function(){return(new Date).getTime()};function s(t,n,e){t.classList.contains(n)&&t.classList.remove(n),t.classList.add(e)}function d(e,d,w){var u,v,c,f,y,l;if(!e)throw new Error('Iconate > "element" is required');if(!r)return s(e,d.from,d.to),void("function"==typeof w&&w());function p(){var t=m(),n=u/2;v=window.setTimeout(function(){m()-t>=n&&s(e,d.from,d.to)},n)}c=(d=d||{}).animation||a,u=d.duration||o,e.addEventListener(t,p,!1),e.addEventListener(n,function o(){var i;window.clearTimeout(v),(i=e).style.removeProperty("-webkit-animation"),i.style.removeProperty("animation"),i.style.removeProperty("-moz-animation"),i.style.removeProperty("-o-animation"),e.removeEventListener(n,o),e.removeEventListener(t,p),"function"==typeof w&&w()},!1),y=c,l=u/i,(f=e).style.setProperty("-webkit-animation",y+" "+l+"s"),f.style.setProperty("animation",y+" "+l+"s"),f.style.setProperty("-moz-animation",y+" "+l+"s"),f.style.setProperty("-o-animation",y+" "+l+"s")}"object"==typeof exports?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):window.iconate=d}(); +*/ \ No newline at end of file diff --git a/src/iconate.js b/src/iconate.js index c3bc4dd..d3df953 100644 --- a/src/iconate.js +++ b/src/iconate.js @@ -45,11 +45,14 @@ } function changeClasses(element, from, to) { - if (element.classList.contains(from)) { - element.classList.remove(from); + if(from!==null && to!==null){ + from.split(' ').forEach(className => { + element.classList.remove(className); + }); + to.split(' ').forEach(className => { + element.classList.add(className); + }); } - - element.classList.add(to); } function iconate(el, options, callback) {