HTML5触摸事件演化tap事件介绍

2020-04-24 19:38:48易采站长站整理

                callback.apply(scope, arguments);    
            }    
        });    
    }    
    NodeTouch.prototype.on = function(evt, callback, scope) {    
        var scopeObj;    
        var x,y;    
        if (!scope) {    
            scopeObj = this._node;    
        } else {    
            scopescopeObj = scope;    
        }    
        if (evt === ‘tap’) {    
            tap(this._node,callback,scope);    
        } else if(evt === ‘longtap’){    
            longTap(this._node,callback,scope);    
        } else {    
            this._node.addEventListener(evt, function() {    
                callback.apply(scope, arguments);    
            });    
        }    
        return this;    
    }    
    window.$ = function(selector) {    
        var node = document.querySelector(selector);    
        if (node) {    
            return new NodeTouch(node);    
        } else {    
            return null;