/*返回顶部*/ var myTimer = -1; $(".goTop").click(function (){ var scrollTo = document.documentElement.scrollTop || document.body.scrollTop if(myTimer == -1){ myTimer = setInterval(() => { scrollTo -= 60 if(scrollTo<=0){ scrollTo = 0 window.clearInterval(myTimer) myTimer = -1 } window.scrollTo(0,scrollTo) //这是值 是指离开网页顶部的距离 }, 10); } }) var clickFn = function (arr) { $(arr[0]).click(function () { let i = $(this).index() $(arr[0]).eq(i).addClass(arr[1]).siblings(arr[0]).removeClass((arr[1])) if(arr.length>2){ $(arr[2]).eq(i).attr('style', 'display:block;').siblings(arr[2]).attr('style', 'display:none') } }) } clickFn(['.gmliveBtm>li', 'ActBrcolor1','.gmSwitch']) clickFn(['.gmDul1>li', 'ActBgcolor1','.gmTb1']) clickFn(['.gmDall1>li', 'ActBgcolor','.gmTable1']) clickFn(['.gmDall1>li', 'ActBgcolor','.gmTable2']) clickFn(['.gmDall2>li', 'ActBgcolor','.gmDTb2']) clickFn(['.gmDall3>li', 'ActBgcolor','.gmDTb3']) if ($(".zhankaiall").length > 0) { $(".zhankaiall").click(function () { // $(".zc_nrong").removeAttr("style"); $(".zc_nrong").removeClass("zc_nrong").addClass("zc_nrong_modified"); $(".yczhezhao").hide(); $(".zhankaiall").hide(); }); } /**首页球队切换**/ $(".section-tit-nav span").click(function () { $(this).addClass("on").siblings().removeClass("on"); $(".section-hot-team-box") .eq($(this).index()) .addClass("on") .siblings() .removeClass("on") .trigger("scroll"); });