I'm working on an attendance audit screen which allows the user to single click to confirm the selection and double click to create a report. After I googled for the solution, I found the following solution in stackoverflow.com
Below is the code:
// Someone has created the solution as a delegate to ease the implementation.
$.singleDoubleClick = function (singleClk, doubleClk) {
return (function () {
var alreadyclicked = false;
var alreadyclickedTimeout;
return function (e) {
if (alreadyclicked) {
// double
alreadyclicked = false;
alreadyclickedTimeout && clearTimeout(alreadyclickedTimeout);
doubleClk && doubleClk(e);
} else {
// single
alreadyclicked = true;
alreadyclickedTimeout = setTimeout(function () {
alreadyclicked = false;
singleClk && singleClk(e);
}, 300);
}
}
})();
}
// call this in the document ready:
$('.profile').bind('click', $.singleDoubleClick(confirmSelection, createReport));
Subscribe to:
Post Comments (Atom)
We are moving
We are moving this blog to our new blog site: https://ciysys.com/blog/nodejs.htm
-
Overview Usually, we start developing a new system with designing database and then writing codes. If you are not a fan of ORM, you will h...
-
I'm working on an attendance audit screen which allows the user to single click to confirm the selection and double click to create a re...
-
You cannot achieve the fixed row and column with HTML + CSS. You need the Javascript as well. Below is the HTML, CSS and Javasript th...
No comments:
Post a Comment