|
@@ -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;
|