js自定义双击函数

//双击返回头部
jq('.title-bar').click(function(){
    if(this.old_time){
        this.new_time = new Date().getTime();
        if(this.new_time-this.old_time<300){
            jq('body').animate({'scrollTop':0}, 500, function(){
                if(toTopCallBack) toTopCallBack();
            });
        }
        this.old_time = new Date().getTime();
    }else{
        this.old_time = new Date().getTime();
    }
});
原文地址:https://www.cnblogs.com/tujia/p/6140551.html