// 屏幕试图的高度 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() }) // 用户评价点击事件 let numberClick = 0 // 移动的距离 let mobiledistance = 0 $(function() { kehuFlg() $('#kehuRight').click(function() { if(numberClick < 3) { numberClick++ zuoyouClick() } }) $('#kehuLeft').click(function() { if(numberClick > 0 && numberClick <= 3) { numberClick-- zuoyouClick() } }) }) function zuoyouClick() { console.log(numberClick) mobiledistance = '-' + (numberClick * 396) + 'px' $('.userEvaluationRight').stop(true,false).animate({ 'left': mobiledistance }, 400) kehuFlg() } function kehuFlg() { if(numberClick == 0) { $('#kehuLeft').find('img').attr("src", './image/ions/zuos.png') $('#kehuLeft').addClass("zhis") } else { $('#kehuLeft').find('img').attr("src", './image/ions/zuo.png') $('#kehuLeft').removeClass("zhis") } if(numberClick >= 3) { $('#kehuRight').find('img').attr("src", './image/ions/yous.png') $('#kehuRight').addClass("zhis") } else { $('#kehuRight').find('img').attr("src", './image/ions/you.png') $('#kehuRight').removeClass("zhis") } }