How to prevent a double-click using jQuery?

前端 未结 15 799
孤街浪徒
孤街浪徒 2020-11-30 23:42

I have a button as such:


Within jQuery I am using the following, but it still

15条回答
  •  粉色の甜心
    2020-12-01 00:43

    What I found out was old but working solution on modern browsers. Works for not toggling classes on the double click.

    $('*').click(function(event) {
        if(!event.detail || event.detail==1){//activate on first click only to avoid hiding again on double clicks
            // Toggle classes and do functions here
            $(this).slideToggle();
        }
    });
    

提交回复
热议问题