我在页面上使用weareoutman's clockpicker。如何防止点击输入在clockpicker出现之前显示clockpicker或淡入覆盖?我只是想在clockpicker显示之前淡入叠加。点击"按钮"正在按要求工作。到目前为止,我已经尝试了在clockpicker中的beforeShow函数,以及jQuery中的e.preventDefault()和e.stopPropagation()函数。
HTML:
<div class="dialog">
<div>Clock:</div>
<div class="input-group" id="clockpicker">
<input type="text" id="start-time" class="clock text-right" readonly />
<span class="button button-gray icon icon-clock"></span>
</div>
<div class="dialog-overlay hide"></div>
</div>
jQuery的:
var clock = jQuery('#clockpicker'),
dialog_overlay = jQuery('.dialog-overlay');
clock.clockpicker({
autoclose: true,
afterDone: function() {
dialog_overlay.fadeOut('slow');
}
});
clock.on('click', function(e) {
dialog_overlay.fadeIn('slow', function() {
clock.clockpicker('show');
});
});
答案 0 :(得分:3)
我找到了解决问题的方法。在输入字段中设置单击事件。
DocReader(noflo-mongo/MongoBase)
我希望这个解决方案能帮助其他人。
答案 1 :(得分:0)
使用最新版本的库,您可以执行以下操作:
$('#inputId').clockpicker({
beforeShow: function e() {
var condition = "...";
if (!condition) {
e.stopPropagation();
}
}
});