Is there a plug-in at the mobile end that moves along with the fingers?

  node.js, question

If you don’t need to slide and switch slides, you can think of it as an element with a large width, and you can switch horizontally from left to right by dialing with your finger.

None of these apply (or I won’t): swipe.js, touch.js, iscroll.js

I wrote the slide assembly myself:
The key is to save the location of the last touchMove, but the optimization is not good enough.

The code is as follows:

/**
 * Created by Administrator on 2016/8/12.
 */
 
 
 function Slider(opts){
 //¹¹Ô캯ÊýÐèÒªµÄ²ÎÊý
 this.wrap = opts.dom;
 this.dire = opts.direction;
 this.addtion = opts.addtion;
 this.bindDOM();
 bracket
 
 
 
 
 
 
 Slider.prototype.bindDOM = function(){
 var self = this;
 var moveP;
 
 //ÊÖÖ¸°´ÏµĴ¦Àíʼþ
 var startHandler = function(evt){
 
 
 
 if(moveP.x) console.log(moveP)
 self.startX = moveP.x ?   moveP.x : evt.touches[0].pageX;
 self.startY = moveP.y ?   moveP.y : evt.touches[0].pageY;
 console.log("start X"
 Startx)
 
 
 };
 
 var moveHandler = function(evt){
 //¼æÈÝchrome android£¬×èÖ¹ä¯ÀÀÆ÷ĬÈÏÐÐΪ
 evt.preventDefault();
 
 
 moveP.x = evt.targetTouches[0].pageX;
 moveP.y = evt.targetTouches[0].pageY;
 
 bracket
 
 //  console.log(self.dire)
 if(self.dire === 'horizon'){
 if(Math.abs(moveP.x-self.startX) > Math.abs(moveP.y - self.startY)){
 // move horizontal
 self.offsetX = moveP.x - self.startX;
 if(self.offsetX > 550){self.offsetX = 300;  bracket
 if(self.offsetX < 0){
 //  change transform style with offsetX
 console.log('enter right 2 left')
 
 //console.log ('curoffsetx' plus self.offsetX)
 self.wrap.style.webkitTransition = ('-webkit-transform 0s ease-out');
 Self.wrap.style.webkit transform = ('translate 3d ('plus self.offsetX plus' px, 0, 0)');
 } else{
 Log ('enterleft 2right' plus self.offsetX)
 
 if (self.wrap.style.webkitTransform >= 0) {
 self.wrap.style.webkitTransition = ('-webkit-transform 0s ease-out');
 self.wrap.style.webkitTransform = ('translate3d(0px,0,0)');
 //  self.addtion.style.webkitTransform = ('translate3d(0px,0,0)');
 };
 self.wrap.style.webkitTransition = ('-webkit-transform 0s ease-out');
 Self.wrap.style.webkit transform = ('translate 3d ('add (self.offsetX) plus' px, 0, 0)');
 
 
 bracket
 bracket
 } else if(self.dire === 'vertical'){
 if(Math.abs(moveP.x-self.startX) < Math.abs(moveP.y - self.startY)){
 // move horizontal
 self.offsetY = moveP.y - self.startY;
 if(self.offsetY < 0){
 //  change transform style with offsetX
 
 
 //console.log ('curoffset y' plus self.offsetY)
 console.log('down to up')
 self.wrap.style.webkitTransition = ('-webkit-transform 0s ease-out');
 Self.wrap.style.webkit transform = ('translated 3d (0px,' plus self.offsetY plus' px,0)');
 Self.addition.style.webkit transform = ('translated3d (0px,' plus self.offsetY plus' px,0)');
 
 }else{
 console.log('up to down')
 
 var fixed_body = document.getElementById('fixed-body');
 if(fixed_body.style.webkitTransform.indexOf('-') > 0){
 self.wrap.style.webkitTransition = ('-webkit-transform 0s ease-out');
 self.wrap.style.webkitTransform = ('translate3d(0px,0,0)');
 self.addtion.style.webkitTransform = ('translate3d(0px,0,0)');
 bracket
 bracket
 bracket
 bracket
 
 document.getElementById('swipe_table_title').style.position = 'fixed !  important';
 document.getElementById('fixed_table_title').style.position = 'fixed !  important';
 
 
 console.log(moveP.x)
 };
 
 
 
 
 new Slider({
 dom : document.getElementById('swipe_table'),
 direction : 'horizon'
 });
 
 new Slider({
 dom : document.getElementById('fixed-body'),
 direction : 'vertical',
 addtion : document.getElementById('swiper-body')
 });
 
 new Slider({
 dom : document.getElementById('swiper-body'),
 direction : 'vertical',
 addtion : document.getElementById('fixed-body')
 });

You can use the mobile phone effect touchslide.js, web addresshttp://www.superslide2.com/If you can’t use it, you can use zepto.js This is for Mobile client.