index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. $(function () {
  2. // 侧导航分类
  3. $(".sub-list li").hover(function () {
  4. $(this).find(".nav-box").css("display", "block");
  5. }, function () {
  6. $(this).find(".nav-box").css("display", "none");
  7. });
  8. // 图片懒加载
  9. var swiper = new Swiper('#slide1', {
  10. speed: 600,
  11. autoplay: {
  12. delay: 4000
  13. },
  14. loop: true,
  15. pagination: {
  16. el: '.swiper-pagination',
  17. clickable: true,
  18. },
  19. lazy: {
  20. loadPrevNext: true,
  21. }
  22. });
  23. var tsw = new Swiper('#notice', {
  24. autoplay: {
  25. delay: 3000,
  26. disableOnInteraction: false,
  27. },
  28. loop: true,
  29. direction: 'vertical',
  30. slidesPerView: 6,
  31. });
  32. var reco = new Swiper('#slide2', {
  33. speed: 900,
  34. loop: true,
  35. autoplay: {
  36. delay: 4000
  37. },
  38. lazy: {
  39. loadPrevNext: true,
  40. },
  41. pagination: {
  42. el: '.swiper-pagination',
  43. clickable: true,
  44. },
  45. });
  46. $(".tab-1 span").hover(function () {
  47. $(this).addClass("on").siblings().removeClass("on");
  48. var index = $(this).index();
  49. $(".tab-box-1 ul").eq(index).addClass("active").siblings().removeClass("active");
  50. });
  51. $(".tab-2 span").hover(function () {
  52. $(this).addClass("on").siblings().removeClass("on");
  53. var index = $(this).index();
  54. $(".tab-box-2 ul").eq(index).addClass("active").siblings().removeClass("active");
  55. });
  56. var ppjj = new Swiper('#join_slide', {
  57. autoplay: {
  58. delay: 3000,
  59. disableOnInteraction: false,
  60. },
  61. speed: 900,
  62. loop: true,
  63. navigation: {
  64. nextEl: '.s-next',
  65. prevEl: '.s-prev',
  66. },
  67. });
  68. if(ppjj.el){
  69. ppjj.el.onmouseover = function () {
  70. ppjj.autoplay.stop();
  71. }
  72. ppjj.el.onmouseout = function () {
  73. ppjj.autoplay.start();
  74. }
  75. }
  76. // 品牌排行
  77. $('.rank-box li').hover(function () {
  78. $(this).addClass('active').siblings().removeClass('active');
  79. })
  80. // 全部分类
  81. $(".all-classify-nav span").hover(function () {
  82. $(this).addClass("on").siblings().removeClass("on");
  83. var index = $(this).index();
  84. $(".all-classify-box ul").eq(index).addClass("active").siblings().removeClass("active");
  85. });
  86. // 加盟咨询动态
  87. var culat = new Swiper('#consultation', {
  88. autoplay: {
  89. delay: 2000,
  90. disableOnInteraction: false,
  91. },
  92. speed: 600,
  93. loop: true,
  94. direction: 'vertical',
  95. slidesPerView: 5,
  96. spaceBetween: 30,
  97. });
  98. // mobile
  99. var wid_1 = $('.dpjxCon li').width();
  100. $('.dpjxCon li img').height(wid_1 * 0.62);
  101. // 屏幕改变
  102. $(window).resize(function () {
  103. var wid_1 = $('.dpjxCon li').width();
  104. $('.dpjxCon li img').height(wid_1 * 0.62);
  105. })
  106. })