html代码如下:

<button>点击</button>

JQ代码如下:

   <script>
        $(function () {
            // 编写相关jQuery代码
            // 单双击的时间间隔是300ms
            // 先做两次单击 一次双击 中间间隔 小于300ms
            var timer = null;

            // 获取事件源,绑定事件
            $('button').click(function () {
                // 清除定时器
                clearTimeout(timer);
                // 设置定时器 300ms 一次性定时器
                timer = setTimeout(function () {
                    console.log('单机');
                },300)
            });

            $('button').dblclick(function () {
                // 清除定时器
                clearTimeout(timer);
                console.log('双击');
            })
        })
    </script>

 

相关文章:

  • 2021-12-18
  • 2021-12-27
  • 2021-12-12
  • 2021-12-03
  • 2022-01-01
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-19
  • 2022-12-23
  • 2021-11-16
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
相关资源
相似解决方案