// 屏幕试图的高度 let screenHeight = $(window).height() console.log(screenHeight) // 获取团队协作的高度 let collaborationTeamHeight = $('#collaborationTeam').offset().top // 获取项目模板的高度 let templateProjectHeight = $('#templateProject').offset().top $(window).scroll(function () { // 当前滚动的高度 let currentTop = $(window).scrollTop() if(currentTop < 2) { $('#all').removeClass('hanAll') $('#abc').addClass('abc') } else { $("#all").addClass("hanAll"); $("#abc").removeClass("abc"); } // 团队协作滚动计算 if(currentTop > collaborationTeamHeight && currentTop < (collaborationTeamHeight + screenHeight)) { let teamOffset = (currentTop - collaborationTeamHeight) / screenHeight console.log(teamOffset, '值') $('#collCentImg').css({'transform': `translate(${(1 - teamOffset) * 250}px,0)`}) $('#collCentFonts').css({'transform': `translate(-${(1 - teamOffset) * 550}px,0)`}) } // 项目模板的计算 if(currentTop > templateProjectHeight && currentTop < (templateProjectHeight + screenHeight)) { let teamOffset = (currentTop - templateProjectHeight) / screenHeight console.log(teamOffset, '值') $('#templatOne').css({'transform': `translate(${(1 - teamOffset) * 500}px,0)`}) $('#templatFour').css({'transform': `translate(-${(1 - teamOffset) * 600}px,0)`}) $('#templatThree').css({'transform': `translate(0, ${(1 - teamOffset) * 500}px)`}) } }) // 导航下划线 $('.aus li').hover(function () { let i = $(this).index() $(".aus li").eq(i).addClass('tils') },function () { let i = $(this).index() $(".aus li").eq(i).removeClass('tils') }) $('.auss li').hover(function () { let i = $(this).index() $(".auss li").eq(i).addClass('tils') },function () { let i = $(this).index() $(".auss li").eq(i).removeClass('tils') }) // 客服hover $('#zhixun').hover(function () { $("#zhixun").show() $("#consultigImg").attr("src", './image/ions/kefu1.png') },function () { $("#zhixun").hide() $("#consultigImg").attr("src", './image/ions/kefu2.png') }) $('#consulting').hover(function () { $("#zhixun").show() $("#consultigImg").attr("src", './image/ions/kefu1.png') },function () { $("#zhixun").hide() $("#consultigImg").attr("src", './image/ions/kefu2.png') }) // 产品鼠标移入移出 let fls = true $('#productHov').hover(function () {$("#product").show()},function () { setTimeout(function() { if(fls) { $("#product").hide() } }, 200) }) $('#product').hover(function () { fls = false $("#product").show() },function () { fls = true $("#product").hide() })