12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- $(function(){
- //设置标杆
- // var _line=parseInt($(window).height()/3);
- var _line=0;
- $(window).scroll(function(){
- //滚动730px,左侧导航固定定位
- // if ($(window).scrollTop()>0) {
- // $('.list_btn').css({'position':'fixed','top':'55px'})
- // }else{
- // $('.list_btn').css({'position':'','top':''})
- // };
- // console.log($(window).scrollTop())
- $('.list_btn li a').eq(0).addClass('on');
- //滚动到标杆位置,左侧导航加active
- $('.list_r_box .list_cen').each(function(){
- // console.log($(this).offset().top)
- var _target=parseInt($(this).offset().top-$(window).scrollTop()-_line);
- var _i=$(this).index();
- if (_target<=0) {
- $('.list_btn li a').removeClass('on');
- $('.list_btn li a').eq(_i).addClass('on');
- }
- //如果到达页面底部,给左侧导航最后一个加active
- else if($(document).height()==$(window).scrollTop()+$(window).height()){
- $('.list_btn li a').removeClass('on');
- $('.list_btn li a').eq($('.list_r_box .list_cen').length-1).addClass('on');
- }
- });
- });
- $('.list_btn li').click(function(){
- $(this).find('a').addClass('on').siblings().removeClass('active');
- var _i=$(this).index();
- $('body, html').animate({scrollTop:$('.list_r_box .list_cen').eq(_i).offset().top-_line},500);
- });
- //报名验证及提交的调用
- PublicAction.AjaxSend(
- {
- CORID:'apply_submit', /*操作ID*/
- }
- );
-
- })
|