Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button id="button">click</button>
- (function(window, document, undefined){
- 'use strict';
- var start;
- var end;
- var delta;
- var button = document.getElementById("button");
- button.addEventListener("mousedown", function(){
- start = new Date();
- });
- button.addEventListener("mouseup", function() {
- end = new Date();
- delta = end - start;
- if (delta > 0 && delta < 500) {
- alert("less than half second:");
- }
- if (delta > 1000) {
- alert("more than a second:");
- }
- });
- })(window, document);
- var start,
- end,
- delta,
- button = document.getElementById('button');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement