Disable fade animation if needed

This commit is contained in:
Eduardo Gomez 2019-08-20 13:16:45 +02:00
parent f8dde76d74
commit b6380ea899
5 changed files with 20 additions and 16 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{27:function(e,s,t){e.exports=t(28)},28:function(e,s,t){"use strict";t.r(s);var n=t(0),a=t.n(n),o=(t(6),t(15)),i=t(17),l=t.n(i),c=t(18),r=t(20),d=t.n(r);a()(document).ready(function(){var e,s,t,n,i,r=a()("body"),u=a()(".js-header"),h=a()(".js-open-menu"),m=a()(".js-close-menu"),f=a()(".js-menu"),v=a()(".js-toggle-submenu"),p=a()(".js-submenu-option")[0],g=a()(".js-submenu"),w=a()(".js-recent-articles"),C=a()(".js-open-search"),j=a()(".js-close-search"),b=a()(".js-search"),k=a()(".js-input-search"),y=a()(".js-search-results"),x=a()(".js-no-results"),_=u.outerHeight(),L=null,A=window.pageYOffset,O=!1,S=!1;function D(){var e=window.pageYOffset;e>=_?(u.addClass("fixed"),S&&u.addClass("fixed-active"),e>=A?S||u.removeClass("fixed-active"):u.addClass("fixed-active")):(S||u.removeClass("fixed-active"),u.removeClass("fixed")),A=e,O=!1}function E(){u.removeClass("submenu-is-active"),v.removeClass("active"),g.removeClass("opened").addClass("closed")}function H(){r.toggleClass("no-scroll-y")}h.click(function(){f.addClass("opened"),H()}),m.click(function(){f.removeClass("opened"),H()}),v.click(function(){(S=!S)?(u.addClass("submenu-is-active"),v.addClass("active"),g.removeClass("closed").addClass("opened")):E()}),C.click(function(){b.addClass("opened"),setTimeout(function(){k.focus()},400),H()}),j.click(function(){k.blur(),b.removeClass("opened"),H()}),k.keyup(function(){if(k.val().length>0&&L){var e=L.search(k.val()),s="";if(e.length>0){for(var t=0,n=e.length;t<n;t++)s+='\n <article class="m-result"> <a href="'.concat(e[t].url,'" class="m-result__link"> <h3 class="m-result__title">').concat(e[t].title,'</h3> <span class="m-result__date">').concat((a=e[t].published_at)?new Date(a).toLocaleDateString(document.documentElement.lang,{year:"numeric",month:"long",day:"numeric"}):"","</span> </a> </article>");x.hide(),y.html(s),y.show()}else y.html(""),y.hide(),x.show()}else y.html(""),y.hide(),x.hide();var a}),a()(window).click(function(e){S&&p&&!p.contains(e.target)&&(S=!1,E())}),w.length>0&&w.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0}),l.a.init({once:!0,startEvent:"DOMContentLoaded"}),Object(o.a)(".js-tooltip"),"undefined"!=typeof ghostSearchApiKey?(e=ghostHost,s=ghostSearchApiKey,t=new c.a({host:e,key:s,version:"v2"}),n=[],i={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!0,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},t.posts.browse({limit:"all",fields:"id, title, url, published_at, custom_excerpt, html"}).then(function(e){for(var s=0,t=e.length;s<t;s++)n.push(e[s]);L=new d.a(n,i)}).catch(function(e){console.log(e)})):(C.remove(),j.remove(),b.remove()),window.addEventListener("scroll",function(){O||requestAnimationFrame(D),O=!0},{passive:!0})})}},[[27,0,1]]]); (window.webpackJsonp=window.webpackJsonp||[]).push([[2],{27:function(e,s,t){e.exports=t(28)},28:function(e,s,t){"use strict";t.r(s);var n=t(0),a=t.n(n),o=(t(6),t(15)),i=t(17),l=t.n(i),c=t(18),d=t(20),r=t.n(d);a()(document).ready(function(){var e,s,t,n,i,d=a()("body"),u=a()(".js-header"),h=a()(".js-open-menu"),m=a()(".js-close-menu"),f=a()(".js-menu"),v=a()(".js-toggle-submenu"),p=a()(".js-submenu-option")[0],g=a()(".js-submenu"),C=a()(".js-recent-articles"),w=a()(".js-open-search"),b=a()(".js-close-search"),j=a()(".js-search"),k=a()(".js-input-search"),y=a()(".js-search-results"),x=a()(".js-no-results"),_=u.outerHeight(),A=null,L=window.pageYOffset,F=!1,O=!1;function S(){var e=window.pageYOffset;e>=_?(u.addClass("fixed"),O&&u.addClass("fixed-active"),e>=L?O||u.removeClass("fixed-active"):u.addClass("fixed-active")):(O||u.removeClass("fixed-active"),u.removeClass("fixed")),L=e,F=!1}function D(){u.removeClass("submenu-is-active"),v.removeClass("active"),g.removeClass("opened").addClass("closed")}function E(){d.toggleClass("no-scroll-y")}h.click(function(){f.addClass("opened"),E()}),m.click(function(){f.removeClass("opened"),E()}),v.click(function(){(O=!O)?(u.addClass("submenu-is-active"),v.addClass("active"),g.removeClass("closed").addClass("opened")):D()}),w.click(function(){j.addClass("opened"),setTimeout(function(){k.focus()},400),E()}),b.click(function(){k.blur(),j.removeClass("opened"),E()}),k.keyup(function(){if(k.val().length>0&&A){var e=A.search(k.val()),s="";if(e.length>0){for(var t=0,n=e.length;t<n;t++)s+='\n <article class="m-result"> <a href="'.concat(e[t].url,'" class="m-result__link"> <h3 class="m-result__title">').concat(e[t].title,'</h3> <span class="m-result__date">').concat((a=e[t].published_at)?new Date(a).toLocaleDateString(document.documentElement.lang,{year:"numeric",month:"long",day:"numeric"}):"","</span> </a> </article>");x.hide(),y.html(s),y.show()}else y.html(""),y.hide(),x.show()}else y.html(""),y.hide(),x.hide();var a}),a()(window).click(function(e){O&&p&&!p.contains(e.target)&&(O=!1,D())}),C.length>0&&C.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0}),"undefined"!=typeof disableFadeAnimation&&disableFadeAnimation?a()("[data-aos]").addClass("no-aos-animation"):l.a.init({once:!0,startEvent:"DOMContentLoaded"}),Object(o.a)(".js-tooltip"),"undefined"!=typeof ghostSearchApiKey?(e=ghostHost,s=ghostSearchApiKey,t=new c.a({host:e,key:s,version:"v2"}),n=[],i={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!0,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},t.posts.browse({limit:"all",fields:"id, title, url, published_at, custom_excerpt, html"}).then(function(e){for(var s=0,t=e.length;s<t;s++)n.push(e[s]);A=new r.a(n,i)}).catch(function(e){console.log(e)})):(w.remove(),b.remove(),j.remove()),window.addEventListener("scroll",function(){F||requestAnimationFrame(S),F=!0},{passive:!0})})}},[[27,0,1]]]);

View file

@ -54,5 +54,5 @@
"desktop": "assets/screenshot-desktop.jpg", "desktop": "assets/screenshot-desktop.jpg",
"mobile": "assets/screenshot-mobile.jpg" "mobile": "assets/screenshot-mobile.jpg"
}, },
"version": "0.2.3" "version": "0.2.4"
} }

View file

@ -230,10 +230,14 @@ $(document).ready(() => {
}) })
} }
if (typeof disableFadeAnimation === 'undefined' || !disableFadeAnimation) {
AOS.init({ AOS.init({
once: true, once: true,
startEvent: 'DOMContentLoaded', startEvent: 'DOMContentLoaded',
}) })
} else {
$('[data-aos]').addClass('no-aos-animation')
}
tippy('.js-tooltip') tippy('.js-tooltip')

View file

@ -8,7 +8,7 @@ $aos-distance: 100px !default;
* fade-up-right, fade-up-left, fade-down-right, fade-down-left * fade-up-right, fade-up-left, fade-down-right, fade-down-left
*/ */
[data-aos^='fade'][data-aos^='fade'] { [data-aos^='fade'][data-aos^='fade']:not(.no-aos-animation) {
opacity: 0; opacity: 0;
transition-property: opacity, transform; transition-property: opacity, transform;
@ -18,34 +18,34 @@ $aos-distance: 100px !default;
} }
} }
[data-aos='fade-up'] { [data-aos='fade-up']:not(.no-aos-animation) {
transform: translate3d(0, $aos-distance, 0); transform: translate3d(0, $aos-distance, 0);
} }
[data-aos='fade-down'] { [data-aos='fade-down']:not(.no-aos-animation) {
transform: translate3d(0, -$aos-distance, 0); transform: translate3d(0, -$aos-distance, 0);
} }
[data-aos='fade-right'] { [data-aos='fade-right']:not(.no-aos-animation) {
transform: translate3d(-$aos-distance, 0, 0); transform: translate3d(-$aos-distance, 0, 0);
} }
[data-aos='fade-left'] { [data-aos='fade-left']:not(.no-aos-animation) {
transform: translate3d($aos-distance, 0, 0); transform: translate3d($aos-distance, 0, 0);
} }
[data-aos='fade-up-right'] { [data-aos='fade-up-right']:not(.no-aos-animation) {
transform: translate3d(-$aos-distance, $aos-distance, 0); transform: translate3d(-$aos-distance, $aos-distance, 0);
} }
[data-aos='fade-up-left'] { [data-aos='fade-up-left']:not(.no-aos-animation) {
transform: translate3d($aos-distance, $aos-distance, 0); transform: translate3d($aos-distance, $aos-distance, 0);
} }
[data-aos='fade-down-right'] { [data-aos='fade-down-right']:not(.no-aos-animation) {
transform: translate3d(-$aos-distance, -$aos-distance, 0); transform: translate3d(-$aos-distance, -$aos-distance, 0);
} }
[data-aos='fade-down-left'] { [data-aos='fade-down-left']:not(.no-aos-animation) {
transform: translate3d($aos-distance, -$aos-distance, 0); transform: translate3d($aos-distance, -$aos-distance, 0);
} }