Skip to content

Instantly share code, notes, and snippets.

@fronteer-kr
Last active August 29, 2015 14:12
Show Gist options
  • Save fronteer-kr/a5621340b69e802f4181 to your computer and use it in GitHub Desktop.
Save fronteer-kr/a5621340b69e802f4181 to your computer and use it in GitHub Desktop.
Click 이벤트 중복 방지처리
var _lastCickTime = new Date().getTime();
document.addEventListener('click', function (e) {
var clickTime = e['timeStamp'];
if (clickTime && (click_time - _lastCickTime) < 500) {
e.stopImmediatePropagation();
e.preventDefault();
return false;
}
_lastCickTime = clickTime;
}, true); // true : event capturing phase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment