$(function() { $('.history-one').each(function(index, el) { var $historyonet = $(this).position().top, $ipoint = $('.history-point-list > i'), $linebg = $('.history-line-bg'), dish = 8; // 初始化 if (index == 0) { $ipoint.eq(0).addclass('on'); $linebg.css('height', $historyonet + dish + 'px'); } $ipoint.eq(index).css('top', $historyonet + dish); $(this).hover(function() { $('.history-one').removeclass('on'); $(this).addclass('on'); $ipoint.removeclass('on'); $ipoint.eq(index).addclass('on'); $linebg.css('height', $historyonet + dish + 'px'); }); }); // 编辑框查看更多 $('.about-more a.a-1').click(function(event) { $('.about-more').hide(); $('.about-edit').css('height', 'auto'); }); // 出场效果 var winw = $(window).width(), winh = $(window).height(),//可视窗口高度 scrollt = $(window).scrolltop(),//鼠标滚动的距离 pu = $(window).width()/1920; $(window).scroll(function(){ winw = $(window).width(), winh = $(window).height(),//可视窗口高度 scrollt = $(window).scrolltop(),//鼠标滚动的距离 pu = $(window).width()/1920; divmove('.history'); function divmove(sel) { if (winh + scrollt - $(sel).offset().top > winh*(1/4) && scrollt < $(sel).height() + $(sel).offset().top) { $(sel).addclass('move'); $(sel).find('.letmove').addclass('move'); } } }); //平航锚点导航 var aarr = ['profile', 'history', 'honor']; var winw = $(window).width(); var initt = 124; var navmoveflag = false; var navmovetime; $('.nav-inside > ul > li').click(function() { var _index = $(this).index(); $('.nav-inside > ul > li').eq(_index).addclass('on').siblings().removeclass('on'); $('html,body').stop().animate({scrolltop: $('#'+ aarr[$(this).index()] +'').offset().top - initt + 'px'}, 1000); // if (winw < 769) { // $(".header-menu").stop().slideup(350, 'easeinquad'); // $('.m-close').removeclass('m-close-on'); // } $('.nav-inside-arrow').stop().animate({top: 44*_index + 19 + 'px'}, 500); navmoveflag = true; cleartimeout(navmovetime); navmovetime = settimeout(navmovefalse, 1000); }); function navmovefalse() { navmoveflag = false; } $(window).scroll(function(){ var winh = $(window).height();//可视窗口高度 var itop = $(window).scrolltop();//鼠标滚动的距离 //鼠标滑动式改变 if (winh+itop - $('#profile').offset().top > winh/4 && !navmoveflag) { $('.nav-inside > ul > li').eq(0).addclass('on').siblings().removeclass('on'); $('.nav-inside-arrow').stop().animate({top: 44*0 + 19 + 'px'}, 500); } if (winh+itop - $('#history').offset().top > winh/4 && !navmoveflag) { $('.nav-inside > ul > li').eq(1).addclass('on').siblings().removeclass('on'); $('.nav-inside-arrow').stop().animate({top: 44*1 + 19 + 'px'}, 500); } if (winh+itop - $('#honor').offset().top > winh/4 && !navmoveflag) { $('.nav-inside > ul > li').eq(2).addclass('on').siblings().removeclass('on'); $('.nav-inside-arrow').stop().animate({top: 44*2 + 19 + 'px'}, 500); } }); });