如何停止执行eventlisteners

时间:2017-07-20 15:07:08

标签: javascript

您好我的小项目有些问题。我想在mouseup事件调用后停止执行mousedown和mousemove事件。但之后,mousedown事件必须再次激活。它应该像重置一样工作。这是代码

 function quotesMouseDown(event) {
         var isMouseDown = true;
         document.getElementById("quotes").addEventListener("mouseup", 
         function() {
              isMouseDown = false;
          });
          if (isMouseDown == false) {
               return false;
          }
          else {
                   var mDownX = event.pageX;

             document.getElementById("quotes").addEventListener("mousemove", quotoesMouseMove);

                 function quotoesMouseMove(event) {
                     var mMoveX = event.pageX;
                     console.log(mMoveX);
                     console.log(mDownX + "cos")
                  }
         }
          console.log(isMouseDown);
    }

 document.getElementById("quotes").addEventListener("mousedown", quotesMouseDown);

1 个答案:

答案 0 :(得分:0)

仅{strong> detach $PeopleID_List = Get-Content YourList.txt $csv | where { $_.PeopleID -in $PeopleID_List } | % { # Do something with the matched record here. Reference it with $_ } 回调结束时的mousedown回调:

mouseup