Skip to content

Added setting for onBeforeShow and onBeforeHide events #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions jquery.timePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
if ($tpDiv.is(":visible")) {
return false;
}
settings.onBeforeShow() || $.noop();
$("li", $tpDiv).removeClass(selectedClass);

// Position
Expand Down Expand Up @@ -120,7 +121,7 @@
// Hide timepicker on blur
$(elm).blur(function() {
if (!tpOver) {
$tpDiv.hide();
$.timePicker(this).hidePicker();
}
});
// Keypress doesn't repeat on Safari for non-text keys.
Expand Down Expand Up @@ -182,7 +183,7 @@
return false;
break;
case 27: // Esc
$tpDiv.hide();
hidePicker();
return false;
break;
}
Expand All @@ -203,6 +204,12 @@
// Trigger element's change events.
$(elm).change();
};

this.hidePicker = function() {
// Hide picker
settings.onBeforeHide() || $.noop();
$tpDiv.hide();
}

}; // End fn;

Expand All @@ -226,8 +233,7 @@
if (!$.browser.msie) {
elm.focus();
}
// Hide picker
$tpDiv.hide();
$.timePicker(elm).hidePicker();
}

function formatTime(time, settings) {
Expand Down Expand Up @@ -274,4 +280,4 @@
return time;
}

})(jQuery);
})(jQuery);