在mousedown事件被触发后,我想知道鼠标是否仍在某个元素上:
activityIncrease(number){
setTimeout(function () {
mouseIsDown = I_NEED_SOMETHING_TO_TELL_ME_IF_THE_MOUSE_IS_STILL_DOWN();
if(mouseIsDown) activityIncrease(number++);
}, 100);
}
<div *ngFor="let activity of group.activities"
class="col-xs-12 act"
(mousedown)="activityIncrease(activity.number)">
<p>{{activity.description}}</p>
</div>
我该怎么做?
答案 0 :(得分:0)
保留一个布尔变量mouseIsUp
,如果mouseUpEvent
被触发,则该变量为true,然后在timeoout函数中检查该变量