Trigger click events while button is pressed
问题 I am creating a directive that moves an element to the right. In each click, the item is moved to the right, but I would like that the element moves as long I am keeping the button pressed. .directive("car", function(){ return { restrict:"A", link:function(scope,element,attrs,controller){ var left=0; var car = angular.element(element[0].querySelector('.car')); var move = function(e){ left+=10; car[0].style.left = left+"px"; }; element.on("click", move); } }; }) So how can I detect when the