本文介绍了Clockpicker:如何防止点击输入打开clockpicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页上使用。如何防止点击输入显示clockpicker或淡入overlay之前clockpicker来可见?我只是想在clockpicker显示之前淡入重叠。点击按钮按要求工作。到目前为止,我已经在clockpicker的beforeShow函数中尝试过e.preventDefault()和e.stopPropagation() - jQuery中的函数。

I'm using weareoutman's clockpicker on my page. How to prevent click on input to show clockpicker or fade in overlay before clockpicker come to visible? I just wanted to fade in overlay before clockpicker shows. Click on "button" is working as desired. So far I have tried beforeShow function in clockpicker also e.preventDefault() and e.stopPropagation() -functions in jQuery.

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');
    });
});


推荐答案

我找到了解决方案。

clock.find('input').off('focus.clockpicker click.clockpicker');

我希望这个解决方案也能帮助别人。

I hope that this solution helps someone else also.

这篇关于Clockpicker:如何防止点击输入打开clockpicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 16:53