💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![](https://box.kancloud.cn/f12b058a75886d03eb957bb57af28901_1384x375.png) ~~~ <nav class="menu g-widthmin" jsFloatNav="nav" jsFloatPos="top"> <ul class="menuList g-width g-wrap"> <li class="act" jsFloatNav="part1">内容分类</li> <li jsFloatNav="part2">业务全景图</li> <li jsFloatNav="part3">解决方案</li> <li jsFloatNav="part4">推荐业务</li> <li jsFloatNav="part5">客户案例</li> <li jsFloatNav="part6">合作伙伴</li> </ul> </nav> ~~~ ~~~ /* ----- ----- 页面滚动到相应位置,响应对应导航 -----obj :jsFloatNav="nav" -----opr : jsFloatNav="**" -----gid : jsFloatNavGid="**" -----activeClass : "act" ----- */ if( $('[jsFloatNav]').attr("jsFloatNav") == "nav" ){ var _navArry =[]; var _navArryTop =[]; var _jsFloatNav = $('[jsFloatNav="nav"]').find('[jsFloatNav]'); var _jsFloatNavH = $('[jsFloatNav="nav"]').height(); for (var i = 0; i < _jsFloatNav.length; i++) { _navArry[i] = _jsFloatNav.eq(i).attr("jsFloatNav"); _navArryTop[i] = $('[jsFloatNavGid='+ _navArry[i] +']').position().top - _jsFloatNavH; } _jsFloatNav.on("click",function(){ var _index = $(this).index(); $("body,html").animate({scrollTop: _navArryTop[_index] },500); }); $(window).scroll(function(){ for (var i = 0; i < _navArry.length; i++) { if( $(window).scrollTop() >= _navArryTop[i]){ _jsFloatNav.eq(i).addClass("act").siblings().removeClass("act"); } } }); } ~~~