Browse Source

产品中心

gzb
guozhongbo 1 year ago
parent
commit
b45f5f1610
3 changed files with 23 additions and 10 deletions
  1. 8
    3
      css/product.css
  2. 14
    6
      js/product.js
  3. 1
    1
      sections/product.html

+ 8
- 3
css/product.css View File

@@ -189,6 +189,7 @@
189 189
 }
190 190
 .exam_item {
191 191
   height: 1rem;
192
+  margin-bottom: 0.2rem;
192 193
 }
193 194
  
194 195
 .exam_item img{
@@ -197,20 +198,24 @@
197 198
 }
198 199
 .exam_content {
199 200
   width: 100%;
200
-  height: 5rem;
201
+  height: 6rem;
201 202
   position: relative;
202 203
   overflow: hidden;
203 204
 }
204 205
 .show_exam{
205 206
   width: 100%;
206
-  height: 5rem;
207
+  height:  100%;
207 208
   position: absolute;
208 209
   top: 0;
209 210
   left: 0;
210 211
 }
212
+.exam_slide{
213
+  width: 100%;
214
+  height:  100%;
215
+}
211 216
 .exam_content img {
212 217
   width: 9.8rem;
213
-  height: 5rem;
218
+  height:  100%;
214 219
   object-fit: cover;
215 220
 }
216 221
 .exam_slide{

+ 14
- 6
js/product.js View File

@@ -1,5 +1,5 @@
1 1
 //获取元素
2
-var divheight = $(".show_exam:first").height();
2
+var divheight = $(".exam_one").height()-70;
3 3
 var container = $(".exam_container");
4 4
 var list = $(".show_exam");
5 5
 var buts = $(".exam_item");
@@ -13,13 +13,21 @@ function animate(offset) {
13 13
   var top = parseInt(list.css("top")) + offset;
14 14
   console.log(list.css("top"));
15 15
   var absnum = Math.abs(offset);
16
-  console.log(index, top, offset);
16
+  index++
17
+ 
17 18
   // 边界判断
18
-  if (offset > 0) {
19
-    offset = "+=" + offset;
20
-  } else {
21
-    offset = "-=" + Math.abs(offset);
19
+  // if (offset > 0) {
20
+  //   offset = "+=" + offset;
21
+  // } else {
22
+  //   offset = "-=" + Math.abs(offset);
23
+  // }
24
+  offset = "-=" + Math.abs(offset);
25
+  if(index == 6){
26
+    index = 1;
27
+    offset=0;
28
+    console.log("最后一个");
22 29
   }
30
+  console.log("当前索引",index, top, offset)
23 31
   list.animate({ top: offset }, 300, function () {
24 32
     if (top > -200) {
25 33
     }

+ 1
- 1
sections/product.html View File

@@ -166,7 +166,7 @@
166 166
                 <div class="show_exam">
167 167
                   <div class="exam_slide">
168 168
                     <span>1</span>
169
-                    <img src="../img/product/mtznh.png" />
169
+                    <img class="exam_one" src="../img/product/mtznh.png" />
170 170
                   </div>
171 171
                   <div class="exam_slide">
172 172
                     <span>2</span>

Loading…
Cancel
Save