doujiongqin0687 2015-03-02 08:01
浏览 140
已采纳

在模态对话框中使用Bootstrap Clockpicker

I am using this clockpicker plugin for Bootstrap in my project. Everything works fine when used on a normal page. But when used in a modal dialog, the values are not being picked by the plugin. I am able to select the hours and minutes, but the clock simply disappears once I click on AM/PM or Done button. Also when the modal is scrolled, the clockpicker stays fixed in its initial position, but that's not the case in a normal page. Please help me solve this issue.

  • 写回答

4条回答 默认 最新

  • doufan6544 2015-03-02 22:54
    关注

    It is the issue with modal box. Actually, initially modal is not visible and you would have called the clockpicker before modal box is shown. Try, opening modal box first and then clockpicker js.you can try opening modal box through js.

    $(selector).click(function () {
                $('#myModal').modal('show');  // #myModal (id of modal box)
                $('.clockpicker').clockpicker();   // clockpicker js
            });
    

    If still it's not working then try adding some minor delay to clockpicker js For EG:

     $(selector).click(function () {
           function show_popup() {
                $('.clockpicker').clockpicker();   // clockpicker js  
            };
            window.setTimeout(show_popup, 1000); // 1 seconds    
     });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部