var locoScroll = null $(document).ready(function() { locoScroll = new LocomotiveScroll({ el: document.querySelector(".smooth-scroll"), smooth: true, offset: [0, -300] }); var scrollY = 0; locoScroll.on('scroll', (args) => { // console.log('args,',args); scrollY = args.scroll.y; scrollY >= 30 ? $(".header").addClass("scroll") : $(".header").removeClass("scroll"); jQuery('.article-block').delay(400).scrollClass(); if (scrollY < windowHeight) { jQuery('.operate-banner figure').css('transform', "translate(0px," + (scrollY) / 2.8 + "px)"); }; }); var windowWidth = 0; var windowHeight = 0; function initBox() { windowWidth = ('innerWidth' in window) ? window.innerWidth : document.documentElement.clientWidth, windowHeight = ('innerHeight' in window) ? window.innerHeight : document.documentElement.clientHeight; }; initBox(); jQuery(window).resize(function () { initBox(); setTimeout(function(){ locoScroll.update() }, 1000) }); $('[data-target]').click(function(e){ locoScroll.scrollTo($(this).attr("data-target")); }); $(".commonHover").hover(function(){ $(".common-mouse").addClass("is-show"); },function(){ $(".common-mouse").removeClass("is-show"); }); $(".commonHover").mousemove(function(e){ $(".common-mouse").css('left',e.clientX) $(".common-mouse").css('top',e.clientY ) }) window.onload = function() { locoScroll.update() var hash = location.href.split("&")[1]; if(hash && windowWidth >1024){ locoScroll.scrollTo('#'+hash); locoScroll.update() } } locoScroll.on("call", function (e, i, n) { if("updateSpot1" === e){ if("enter" === i){ $(".technical-menu-list li").eq(parseInt(n.el.getAttribute("data-section"))).addClass("active").siblings().removeClass("active"); } } }) $(".scroll-top").click(function() { locoScroll.scrollTo(0); }) })