-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.js
1 lines (1 loc) · 4.1 KB
/
site.js
1
$(function(){var o,a=$(window),n=$("html"),r=$("body"),d=($("main"),$("#l-header")),l=$("#l-footer"),c=$(".bottom-group"),g=$(".pack-nav"),h=($("#l-loading"),$("#l-pagetop")),f=(d.height(),a.scrollTop(),"is-active"),u=function(){$(".js-setWinHeight").each(function(){$(this).css("height",o+"px")})};!function(){var e,t,i;if(e=window.navigator.userAgent.toLowerCase(),t=window.navigator.appVersion.toLowerCase(),i="unknown",-1!=navigator.userAgent.indexOf("Mac")?n.addClass("is-mac"):n.addClass("is-win"),-1!=e.indexOf("msie")?(i=-1!=t.indexOf("msie 6.")?"is-ie6":-1!=t.indexOf("msie 7.")?"is-ie7":-1!=t.indexOf("msie 8.")?"is-ie8":-1!=t.indexOf("msie 9.")?"is-ie9":-1!=t.indexOf("msie 10.")?"is-ie10":"is-ie",n.addClass(i)):-1!=e.indexOf("trident/7")?(i="is-ie11",n.addClass(i)):-1!=e.indexOf("chrome")?(i="is-chrome",n.addClass(i)):-1!=e.indexOf("safari")?(i="is-safari",n.addClass(i)):-1!=e.indexOf("opera")?(i="is-opera",n.addClass(i)):-1!=e.indexOf("firefox")&&(i="is-firefox",n.addClass(i)),i,Modernizr.touch&&n.addClass("is-touch"),smoothScroll.init({easing:"easeInOutQuint",speed:800,updateURL:!0}),r.is("#top")){var s=document.getElementById("js-video");lottie.loadAnimation({container:s,renderer:"svg",loop:!1,autoplay:!0,path:"/wp-content/themes/mojimo/js/json/data.json",rendererSettings:{}}).addEventListener("complete",function(){$(".intro").addClass(f)})}r.is("#manga")||d.headroom({classes:{initial:"js-toggle-header",pinned:"is-pinned",unpinned:"is-unpinned",top:"is-top",notTop:"is-not-top",bottom:"is-bottom",notBottom:"is-not-bottom"},onPin:function(){h.attr("data-pagetop-status","hidden")},onUnpin:function(){h.attr("data-pagetop-status","show")}}),a.width(),o=a.height(),u(),$(".js-setBgImg").each(function(){var e=$(this),t=e.find(">img"),i=t.attr("src");t.css("display","none"),e.css("background-image",'url("'+i+'")')}),$(".js-toggle-acd").each(function(){var e=$(this),t=e.find(">.js-toggle-acd__trigger"),s=e.find(">.js-toggle-acd__target");t.on("click",function(){var e=$(this),t=e.hasClass(f),i=e.data("faq-id");t?(TweenMax.to(s,.3,{height:0},{ease:"easeInOutSine"}),e.removeClass(f),s.removeClass(f)):(TweenMax.set(s,{height:"auto"}),TweenMax.from(s,.3,{height:0},{ease:"easeInOutSine"}),e.addClass(f),s.addClass(f),null!=i&>ag("event","view_item",{event_category:"FAQ",event_label:i}))})}),$(".js-toggle-menu").each(function(){var e=$(this),t=e.find(".js-toggle-menu__trigger"),i=e.find(".js-toggle-menu__target"),s=e.find("#l-header");e.find(".js-toggle-menu__close"),t.on("click",function(){var e=$(this);e.hasClass(f)?(e.removeClass(f),i.removeClass(f),s.removeClass(f),a.off(".noScroll")):(e.addClass(f),i.addClass(f),s.addClass(f))}),$(document).on("click","a",function(){t.removeClass(f),i.removeClass(f),s.removeClass(f)})}),function(){if(0<$("[data-pos-target]").length){var s=$(".js-change-status__target li");$("[data-pos]").each(function(e,t){scrollMonitor.create(t);var i=scrollMonitor.create(t,{top:100,bottom:-100});i.stateChange(function(){i.isInViewport&&i.isAboveViewport&&(s.removeClass(f),s.eq(e).addClass(f))})})}}(),function(){if(0<$("[data-pos-target2]").length){var s=$(".gnav__list li a");$("[data-pos]").each(function(e,t){scrollMonitor.create(t);var i=scrollMonitor.create(t,{top:100,bottom:-100});i.stateChange(function(){i.isInViewport&&i.isAboveViewport&&(s.removeClass(f),s.eq(e).addClass(f))})})}}(),function(){if(0<$("[data-pos-target]").length){var e,t=$(".main__title"),i=$("[data-pos-target]");$("[data-pos]"),e=0<g.length?i.height()+d.height()+c.innerHeight()+g.innerHeight()+80:i.height()+d.height()+c.innerHeight()+80;var s=scrollMonitor.create(l,{top:e}),o=scrollMonitor.create(t,{top:d.height()});scrollMonitor.create(i),o.enterViewport(function(){i.removeClass("is-fixed")}),o.exitViewport(function(){i.addClass("is-fixed")}),s.fullyEnterViewport(function(){s.isAboveViewport&&i.removeClass("is-fixed").addClass("is-hug-footer")}),s.partiallyExitViewport(function(){s.isAboveViewport||i.addClass("is-fixed").removeClass("is-hug-footer")}),s.isAboveViewport&&i.removeClass("is-fixed").addClass("is-hug-footer")}}()}(),a.scroll(function(){a.scrollTop()}),a.on("resize",function(){a.width(),o=a.height(),d.height(),u()})});