guozhongbo 1 рік тому
джерело
коміт
f2aa6fdfc1
3 змінених файлів з 92 додано та 11 видалено
  1. 39
    1
      css/index.css
  2. 23
    6
      index.html
  3. 30
    4
      js/index.js

+ 39
- 1
css/index.css Переглянути файл

@@ -4,7 +4,7 @@
4 4
   height: 9.42rem;
5 5
   object-fit: cover;
6 6
 }
7
-.home_swiper_container.swiper-container .swiper-wrapper .swiper-slide::after {
7
+/* .home_swiper_container.swiper-container .swiper-wrapper .swiper-slide::after {
8 8
   content: "";
9 9
   position: absolute;
10 10
   width: 100%;
@@ -17,6 +17,44 @@
17 17
     rgba(50, 55, 62, 0) 30.34%,
18 18
     rgba(13, 27, 46, 0.7) 100%
19 19
   );
20
+} */
21
+/* 
22
+width: 13%;
23
+height: 3px;
24
+background-color: rgba(255, 255, 255, 0.3);
25
+opacity: 1;
26
+border-radius: 0;
27
+margin: 0px 10px 0px 0px !important;
28
+position: relative;
29
+*/
30
+.home_swiper_pagination.swiper-pagination {
31
+  left: 0.8rem;
32
+  right: 0;
33
+  bottom: 1.5rem !important;
34
+  margin: 0 auto;
35
+  width: 13rem;
36
+  height: 0.1rem;
37
+  text-align: left;
38
+}
39
+.home_swiper_pagination .pagination_item {
40
+  position: relative;
41
+  float: left;
42
+  margin-right: 0.4rem;
43
+  width: 1.5rem;
44
+  height: 4px;
45
+  background-color: rgba(255, 255, 255, 0.3);
46
+  opacity: 1;
47
+  overflow: hidden;
48
+  /* cursor: pointer; */
49
+}
50
+.home_swiper_pagination .pagination_item .pagination_item_progress {
51
+  position: absolute;
52
+  left: 0;
53
+  top: 0;
54
+  width: 0;
55
+  height: 4px;
56
+  background-color: #fff;
57
+  /* cursor: pointer; */
20 58
 }
21 59
 .home_main {
22 60
   background-color: #fff;

+ 23
- 6
index.html Переглянути файл

@@ -23,7 +23,14 @@
23 23
         </div>
24 24
       </div>
25 25
       <!-- 如果需要分页器 -->
26
-      <div class="swiper-pagination"></div>
26
+      <div class="swiper-pagination home_swiper_pagination">
27
+        <div data-index="0" class="pagination_item">
28
+          <div class="pagination_item_progress"></div>
29
+        </div>
30
+        <div data-index="1" class="pagination_item">
31
+          <div class="pagination_item_progress"></div>
32
+        </div>
33
+      </div>
27 34
     </div>
28 35
     <div class="home_main">
29 36
       <div class="home_superiority_title">我们的优势</div>
@@ -129,27 +136,37 @@
129 136
     </div>
130 137
     <div class="home_serve">
131 138
       <div class="home_serve_main">
132
-        <div class="home_serve_title">多项服务保障<br/>让学校、老师、学生无忧</div>
139
+        <div class="home_serve_title">
140
+          多项服务保障<br />让学校、老师、学生无忧
141
+        </div>
133 142
         <div class="home_serve_item_box">
134 143
           <div class="home_serve_item">
135 144
             <img src="./img/home/serve/hailiangshujuziyuan.png" />
136 145
             <div class="home_serve_item_title">海量数据资源</div>
137
-            <div class="home_serve_item_stitle">优质海量资源,教师不需要重新收集整理</div>
146
+            <div class="home_serve_item_stitle">
147
+              优质海量资源,教师不需要重新收集整理
148
+            </div>
138 149
           </div>
139 150
           <div class="home_serve_item">
140 151
             <img src="./img/home/serve/jingzhunhuaxiang.png" />
141 152
             <div class="home_serve_item_title">精准画像</div>
142
-            <div class="home_serve_item_stitle">全程采集教学数据,深度挖掘开发精准画像,指导师生发展</div>
153
+            <div class="home_serve_item_stitle">
154
+              全程采集教学数据,深度挖掘开发精准画像,指导师生发展
155
+            </div>
143 156
           </div>
144 157
           <div class="home_serve_item">
145 158
             <img src="./img/home/serve/jiaoxueshujufenxi.png" />
146 159
             <div class="home_serve_item_title">教学数据分析</div>
147
-            <div class="home_serve_item_stitle">薄弱知识点,归纳错因,体现能力变化曲线,帮助学生针对性训练</div>
160
+            <div class="home_serve_item_stitle">
161
+              薄弱知识点,归纳错因,体现能力变化曲线,帮助学生针对性训练
162
+            </div>
148 163
           </div>
149 164
           <div class="home_serve_item">
150 165
             <img src="./img/home/serve/zhihuipiyuejishu.png" />
151 166
             <div class="home_serve_item_title">智慧批阅技术</div>
152
-            <div class="home_serve_item_stitle">一键组题自动同步至学生空间,学生提交后,平台自动批阅</div>
167
+            <div class="home_serve_item_stitle">
168
+              一键组题自动同步至学生空间,学生提交后,平台自动批阅
169
+            </div>
153 170
           </div>
154 171
         </div>
155 172
       </div>

+ 30
- 4
js/index.js Переглянути файл

@@ -3,10 +3,36 @@ $(function () {
3 3
   $(".footer_root").load("./sections/comm/footer.html");
4 4
   // nav传值显示下划线
5 5
   $(".header_root").data("nav_info", null);
6
-  let mySwiper = new Swiper ('.home_swiper_container.swiper-container', {
6
+  let _homeSwiperTimer = null;
7
+  let homeSwiper = new Swiper(".home_swiper_container.swiper-container", {
7 8
     loop: true,
8 9
     autoplay: 5000,
9 10
     // 如果需要分页器
10
-    pagination: '.swiper-pagination'
11
-  })
12
-});
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
+});

Завантаження…
Відмінити
Зберегти