我希望通过移动设备实现带角度的简单长按(长按)事件。
正在使用
没有工作
HTML
{ado.Branch Name}
JAVASCRIPT
respond_to do |format|
format.json { render :json => {:ola_booking => @ola_booking,
:ola_products => @ola_products }}
end
CSS
<div class="container-fluid" ng-app="app" ng-controller="MainCtrl">
<center>
<h3 ng-bind="test"></h3>
<div class="box noselect"
on-long-press="itemOnLongPress()"
on-touch-end="itemOnTouchEnd()">
<span>Document</span>
</div>
</center>
</div>
答案 0 :(得分:5)
您需要使用touchstart
和touchend
代替Long Press in JavaScript?
$elm.bind('touchstart', function(evt) {
// Locally scoped variable that will keep track of the long press
$scope.longPress = true;
// We'll set a timeout for 600 ms for a long press
$timeout(function() {
if ($scope.longPress) {
// If the touchend event hasn't fired,
// apply the function given in on the element's on-long-press attribute
$scope.$apply(function() {
$scope.$eval($attrs.onLongPress)
});
}
}, 600);
});
$elm.bind('touchend', function(evt) {
// Prevent the onLongPress event from firing
$scope.longPress = false;