pj_details.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. $(function(){
  2. //设置标杆
  3. // var _line=parseInt($(window).height()/3);
  4. var _line=0;
  5. $(window).scroll(function(){
  6. //滚动730px,左侧导航固定定位
  7. // if ($(window).scrollTop()>0) {
  8. // $('.list_btn').css({'position':'fixed','top':'55px'})
  9. // }else{
  10. // $('.list_btn').css({'position':'','top':''})
  11. // };
  12. // console.log($(window).scrollTop())
  13. $('.list_btn li a').eq(0).addClass('on');
  14. //滚动到标杆位置,左侧导航加active
  15. $('.list_r_box .list_cen').each(function(){
  16. // console.log($(this).offset().top)
  17. var _target=parseInt($(this).offset().top-$(window).scrollTop()-_line);
  18. var _i=$(this).index();
  19. if (_target<=0) {
  20. $('.list_btn li a').removeClass('on');
  21. $('.list_btn li a').eq(_i).addClass('on');
  22. }
  23. //如果到达页面底部,给左侧导航最后一个加active
  24. else if($(document).height()==$(window).scrollTop()+$(window).height()){
  25. $('.list_btn li a').removeClass('on');
  26. $('.list_btn li a').eq($('.list_r_box .list_cen').length-1).addClass('on');
  27. }
  28. });
  29. });
  30. $('.list_btn li').click(function(){
  31. $(this).find('a').addClass('on').siblings().removeClass('active');
  32. var _i=$(this).index();
  33. $('body, html').animate({scrollTop:$('.list_r_box .list_cen').eq(_i).offset().top-_line},500);
  34. });
  35. //报名验证及提交的调用
  36. PublicAction.AjaxSend(
  37. {
  38. CORID:'apply_submit', /*操作ID*/
  39. }
  40. );
  41. })