app1.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // 渲染提交需求按钮
  2. //行业菜单
  3. $('.hangye-has-arrow').click(function () {
  4. $(this).toggleClass('hangye-open');
  5. });
  6. $('.navbar-toggle').click(function () {
  7. var y = $(window).scrollTop();
  8. $('.navbar-toggle .icon-bar').toggleClass('hidden');
  9. $('.navbar-toggle .icon-close-bar').toggleClass('hidden');
  10. if (y == 0) {
  11. $('.site-header').toggleClass('new-face');
  12. }
  13. });
  14. //header tab的选中样式
  15. let pathName = window.location.pathname;
  16. $('#headerNav a').each(function (index, item) {
  17. if ($(item).attr('href') == pathName) {
  18. $(item).addClass('nav-active');
  19. }
  20. if ($(item).attr('href') == '/cases/' && /^(\/cases\/)/.test(pathName)) {
  21. $(item).addClass('nav-active');
  22. }
  23. });
  24. $('#header-solution a').each(function (index, item) {
  25. if ($(item).attr('href') == pathName) {
  26. $('#header-solution-title').addClass('nav-active');
  27. }
  28. });
  29. //案例部分LOGO切换
  30. $('#case-logo-div .case-logo-item').hover(function(){
  31. var index = $(this).index();
  32. $('#case-logo-dec .case-logo-dec-item').eq(index).show();
  33. },function(){
  34. $('#case-logo-dec .case-logo-dec-item').hide();
  35. });
  36. $('#case-logo-dec .case-logo-dec-item').hover(function(){
  37. var index = $(this).index();
  38. $('#case-logo-dec .case-logo-dec-item').hide();
  39. $('#case-logo-dec .case-logo-dec-item').eq(index).show();
  40. },function(){
  41. $('#case-logo-dec .case-logo-dec-item').hide();
  42. });
  43. //切换地址
  44. function onChangeAddress(){
  45. $('#address-tab li').on('click',function () {
  46. var index = $(this).index();
  47. $('#address-tab li').removeClass('active');
  48. $(this).addClass('active');
  49. $('#address-tab .address-info').hide();
  50. $('#address-tab .address-info').eq(index).show();
  51. if(index === 0) {
  52. $('#address-tab .shanghai-bg').stop().animate({opacity: '0'},100);
  53. $('#address-tab .beijing-bg').stop().animate({opacity: '1'},400);
  54. }
  55. if(index === 1){
  56. $('#address-tab .shanghai-bg').stop().animate({opacity: '1'},400);
  57. $('#address-tab .beijing-bg').stop().animate({opacity: '0'},100);
  58. }
  59. })
  60. }
  61. onChangeAddress();
  62. //移动端 tab切换
  63. function onChangeTab() {
  64. $('#tab-box .tab').on('click',function(){
  65. var index = $(this).index();
  66. $('#tab-box .tab').removeClass('active');
  67. $(this).addClass('active');
  68. $('#content-div .content').hide();
  69. $('#content-div .content').eq(index).show();
  70. })
  71. }
  72. onChangeTab();
  73. //案例切换 自动切换
  74. var activeIndex = 0;
  75. var interVal = null;
  76. function onChangeCases(index){
  77. activeIndex = index;
  78. $('#case-logo-nav .case-logo-item').removeClass('active');
  79. $('#case-logo-nav .case-logo-item').eq(index).addClass('active');
  80. $('#case-logo-content .case-logo-item').hide();
  81. $('#case-logo-content .case-logo-item').eq(index).show();
  82. }
  83. function setInter(){
  84. interVal = setInterval(function(){
  85. activeIndex++;
  86. if(activeIndex > $('#case-logo-nav .case-logo-item').length - 1){
  87. activeIndex = 0;
  88. }
  89. onChangeCases(activeIndex);
  90. },3000);
  91. }
  92. setInter();
  93. var timer = null;
  94. $('#case-logo-nav .case-logo-item').on('click',function(){
  95. var index = $(this).index();
  96. onChangeCases(index);
  97. clearInterval(interVal);
  98. if(!timer) {
  99. // clearTimeout(timer);
  100. timer = setTimeout(function () {
  101. setInter();
  102. }, 5000);
  103. }
  104. });