2021年3月18日星期四

How to get previous state after click event?

This is my code:

$("div").on("click", function() {    $("div a").css("pointer-events", "all");  });    $("div").on("mouseleave", function() {    $("div a").css("pointer-events", "none");  });
div {    padding: 10px;    background-color: yellow;    display: inline-block;    pointer-events: none;  }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>    <div>    <a href="https://www.wikipedia.org/">Wikipedia</a>  </div>

Generally, it works. But only once for every link. Instead of the mouseleave, I would need something like after this click. So after the click, the whole page should work like before, it shouldn't be just a one-way function.

I want to use it for something like this. If you drag there links, they get fired automatically when you stop dragging. Links should only be fired after a click. I want to fix that.

How is it possible to do that? Would be soooo thankful for help! <3

https://stackoverflow.com/questions/66701311/how-to-get-previous-state-after-click-event March 19, 2021 at 09:17AM

没有评论:

发表评论