簡體   English   中英

在JavaScript事件中替代`touchmove`

[英]Alternate for `touchmove` in javascript event

替代JavaScript事件中的touchmove 一旦使用touchmove收到如下警告。

'Touch.webkitRadiusX' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusX' instead.
ionic.js:1155 'Touch.webkitRadiusY' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusY' instead.
ionic.js:1155 'Touch.webkitRotationAngle' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.rotationAngle' instead.
ionic.js:1155 'Touch.webkitForce' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.force' instead.

請幫忙。

您可以使用內置的離子手勢跟蹤各種觸摸事件,例如: holdtapdoubletapdragdragstartdragenddragupdragdowndragleftdragrightswipeswipeupswipedownswipeleftswiperighttransformtransformstarttransformendrotatepinchpinchinpinchouttouchrelease

就您而言,我認為touchmove可以替換為drag事件。 此事件為您返回x,y。

這是使用方法:

在您的控制器中:注入$ionicGesture依賴項。

myApp.controller('myCtrl', ['$ionicGesture', function($ionicGesture){
    $ionicGesture.on('drag', function (e) {
        //Your logic here.
        //You can use console.log(JSON.stringify(e, null, 2)) to check the object (x,y coors)
    })
}]);

Ionic Docs網站上了解更多詳細信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM