星火官网,前端页面(前台)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. $(function () {
  2. $(".header_root").load("./sections/comm/header.html");
  3. $(".footer_root").load("./sections/comm/footer.html");
  4. // nav传值显示下划线
  5. $(".header_root").data("nav_info", null);
  6. let _homeSwiperTimer = null;
  7. let homeSwiper = new Swiper(".home_swiper_container.swiper-container", {
  8. loop: true,
  9. autoplay: 5000,
  10. // 如果需要分页器
  11. pagination: ".swiper-pagination",
  12. autoplayDisableOnInteraction : false,
  13. paginationType: "custom",
  14. onSlideChangeStart: function(_swiper){
  15. if (_homeSwiperTimer) {
  16. clearInterval(_homeSwiperTimer);
  17. }
  18. $(".home_swiper_pagination .pagination_item_progress").each(function(i, element){
  19. element.style.width = "0%";
  20. });
  21. },
  22. onSlideChangeEnd: function(_swiper){
  23. if (_homeSwiperTimer) {
  24. clearInterval(_homeSwiperTimer);
  25. }
  26. let _width = 0;
  27. _homeSwiperTimer = setInterval(function() {
  28. _width += 1;
  29. if ($(".home_swiper_pagination .pagination_item_progress")[_swiper.realIndex]) {
  30. $(".home_swiper_pagination .pagination_item_progress")[_swiper.realIndex].style.width = _width + "%";
  31. if (_width === 100 && _homeSwiperTimer) {
  32. clearInterval(_homeSwiperTimer);
  33. }
  34. }
  35. }, 50);
  36. }
  37. });
  38. });