$(function(){ $('.yx_KfClose').on('click', function(event){ $(".yx_KfBox").css({"display":"none"}); }); // 回到顶部的显示与隐藏 $(window).on("load scroll", function() { var top = $(document).scrollTop(), wHeight = $(window).height(); if (top > wHeight) { $(".yx_Up_Button").addClass("yx_Active"); } else { $(".yx_Up_Button").removeClass("yx_Active"); } }); // 回到顶部 $(".yx_Up_Button").on("click", function() { $("html,body").stop().animate({ scrollTop: 0 }, 500); }); //锚点缓动 $('.yx_HD_Btn').click(function(){ $('html,body').animate({scrollTop: ($($(this).attr('href')).offset().top -160 )},800); }); //移动端分类样式 $(".yx_MoPageBtn").on('click',function(){ $(this).next().css("left","0px"); $(this).parent().css("z-index","9999"); }); $(".yx_MoPageClose").on('click',function(){ $(this).parent().css("left","100%"); $(this).parents().css("z-index","9"); }); //Search $(".yx_SearchBtn").on('click',function(){ $(".yx_SearchOne").slideDown().addClass("yx_SActive"); }); $(".yx_SearchClose").on('click',function(){ $(".yx_SearchOne").slideUp().removeClass("yx_SActive"); }); }); //内页banner $(window).scroll(function(){ var flag="+"; if ($(window).scrollTop() > 0) { var k2 = $(window).scrollTop()/2; k2<0?flag=" -":" +"; $(".yx_Banner_N .yx_BN_Img").css("background-position-y","calc(50% "+ flag + " " + Math.abs(k2) +"px)"); }else{ $(".yx_Banner_N .yx_Mo_Img").css("background-position-y","50%"); } });