index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. addNumber(10, 737, 'days')
  2. addNumber(0, 30, 'percent1')
  3. addNumber(0, 50, 'percent2')
  4. addNumber(0, 30, 'percent3')
  5. function addNumber(start, end, id) {
  6. var o = document.querySelector(`#${id}`);
  7. var i = start;
  8. var Interval;
  9. if(i < end) {
  10. Interval = setInterval(function(){
  11. i += 2;
  12. if(i > end) {
  13. clearInterval(Interval);
  14. o.innerHTML = end.toLocaleString();
  15. i = 0;
  16. } else {
  17. o.innerHTML = i.toLocaleString();
  18. }
  19. }, 10)
  20. }
  21. }
  22. $('.items').slick({
  23. centerMode: true,
  24. centerPadding: '10px',
  25. slidesToShow: 3,
  26. dots: true,
  27. responsive: [
  28. {
  29. breakpoint: 768,
  30. settings: {
  31. arrows: false,
  32. centerMode: true,
  33. centerPadding: '40px',
  34. slidesToShow: 3
  35. }
  36. },
  37. {
  38. breakpoint: 480,
  39. settings: {
  40. arrows: false,
  41. centerMode: true,
  42. centerPadding: '40px',
  43. slidesToShow: 1
  44. }
  45. }
  46. ]
  47. });
  48. var menuBar_pc = $('.linktoSection');
  49. menuBar_pc.on("click", function () {
  50. console.log('ss');
  51. var section = $(this).data("section");
  52. $("html,body").animate(
  53. {
  54. scrollTop: $(section).offset().top
  55. },
  56. 400
  57. );
  58. });