doujiongqin0687 2015-03-02 16: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-03 06: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条)

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用