heyang 3 年之前
父节点
当前提交
36c7f4f573

+ 1 - 1
microserviceUserH5/static/css/doubleChristmasActivity.css

@@ -283,7 +283,7 @@ ul, li {
   color: #333333;
 }
 .time-line{
-  width: 0.02rem;
+  width: 0.06rem;
   height: 0.24rem;
   color: #CF1300;
 }

+ 17 - 0
microserviceUserH5/static/js/vender/move.js

@@ -39,6 +39,23 @@ var sliderData = (function(cb){
     }
     distance = currentX - startX;
     translateX = currentX - startX + startTranslate;
+
+    if (translateX > startTranslate) {
+      // 向左划
+      if (distance > width / 3 || distance > 40) {
+        newTranslateX = startTranslate + width;
+      } else {
+        newTranslateX = startTranslate
+      }
+    } else {
+      // 向右划
+      if (Math.abs(distance) > width / 3 || Math.abs(distance) > 40) {
+        newTranslateX = startTranslate - width;
+      } else {
+        newTranslateX = startTranslate
+      }
+    }
+    translateX = newTranslateX;
   
     document.getElementById("slider-list").style.transform = "translateX("+translateX/100+"rem)";
     slideing = true;