theme.js 2.0 KB

1
  1. $(document).ready(function(){tw_anim_init("[data-anim]")});function tw_anim_init(a){$(a).each(function(){var b=$(this);var c=b.data("anim");var e=c?$(c,b):false;var d=b.data("anim-in");if(e&&e.length&&d){e.addClass("tw-outview")}})}function tw_out(a){a.each(function(){var b=$(this);var c=b.data("anim-out-target")?b.data("anim-out-target"):b.data("anim");var f=c?$(c,b):false;var e=b.data("anim-out")?b.data("anim-out"):"tw-anim-hide";var d=b.data("anim-delay")?parseInt(b.data("anim-delay"),10):0;if(f&&f.length&&e){f.each(function(h){var g=$(this).removeClass(e).removeClass("tw-outview").css({opacity:"",visibility:""});setTimeout(function(){g.addClass(e);setTimeout(function(){g.removeClass(e).addClass("tw-outview")},500)},h*d)})}})}function tw_in(a){a.each(function(g){var b=$(this);var c=b.data("anim");var f=c?$(c,b):false;var e=b.data("anim-in");var d=b.data("anim-delay")?parseInt(b.data("anim-delay"),10):0;if(f&&f.length&&e){f.addClass("tw-outview");setTimeout(function(){f.each(function(j){var h=$(this).removeClass(e);setTimeout(function(){h.removeClass("tw-outview").addClass(e).css({opacity:"",visibility:""});if(h[0]._scrollspy){h[0]._scrollspy.inview=true}var i=h.filter(".tw-counterup").length?h.filter(".tw-counterup"):$(".tw-counterup",h);i.each(function(){var l=$(this);var m=l.data("slctr")?l.data("slctr"):"h1";var k=$(m,l);if(k.length){k.trigger("tw-animate")}});setTimeout(function(){h.removeClass(e)},500)},(j+1)*d)})},(g+1)*d)}})}function tw_data_parse(a){var b=[];if(a){a.split(";").forEach(function(c){c=c.trim();if(c){c=c.split(":");b[c[0].trim()]=c[1].trim()}})}return b}function tw_anim_data_con(b,c,d){var a=[];b.each(function(){var e=$(this);var f=e.data("uk-scrollspy")?e.data("uk-scrollspy"):(e.attr("uk-scrollspy")?e.attr("uk-scrollspy"):false);if(f){f=tw_data_parse(f);a.push(f);if(f.target){e.data("anim",(c?c:"")+f.target);e.data("anim-out-target",(d?d:"")+f.target)}if(f.cls){e.data("anim-in",f.cls)}if(f.delay){e.data("anim-delay",f.delay)}}});return a};