zoukankan      html  css  js  c++  java
  • react fake double , bind click and dblclick on the same element

    smartClick:function(id,name,waiter,e){
                    var desk = $$(e.currentTarget).data('raw');
                    if(this.lastClickTime[id] && ((new Date())-this.lastClickTime[id])>70)
                    {//quick click twice , it seems a dblclick
                        console.log('dblclick');
                        this.lastClickTime[id]=undefined;
                        this.clickHandler && clearTimeout(this.clickHandler);
                        this.clickHandler = 0;
                        return;
                    }
    
                    if(!this.clickHandler)
                    {
                        this.clickHandler=setTimeout(function(){
                            console.log('click');
                            this.lastClickTime[id]=undefined;
                            clearTimeout(this.clickHandler);
                            this.clickHandler = 0;
                        }.bind(this),300);
                        this.lastClickTime[id]=new Date();    
                    }                
                    return;
                    
                },
  • 相关阅读:
    shift
    start
    exit
    call
    goto
    Activity生命周期(二)
    color 和 mode
    pause 和 title
    day 4 飞机大战-面向对象
    day 3 创建窗口,移动-函数版
  • 原文地址:https://www.cnblogs.com/zyip/p/5520324.html
Copyright © 2011-2022 走看看