【问题标题】:Arshaw fullcalendar & twitter bootstrap Popover (How to dismiss a popover by clicking outside?)Arshaw fullcalendar & twitter bootstrap Popover(如何通过点击外部来关闭弹出窗口?)
【发布时间】:2013-05-01 21:24:59
【问题描述】:

我找到了以下示例,它显示了我需要从弹出窗口中获得的行为: How to dismiss a Twitter Bootstrap popover by clicking outside?

但是,有谁知道如何在 fullcalendar 中实现类似的行为? (即使用全日历事件)谢谢。

【问题讨论】:

    标签: twitter-bootstrap fullcalendar popover


    【解决方案1】:

    其实我觉得我找到了解决问题的办法:

    $('#calendar').fullCalendar({
            eventRender: function (event, element) {
                if (!event.url)
                {
                    element.popover({
                        placement: 'bottom',
                        html:true,                        
                        title: 'text',
                        content: 'text                                
                    });
    
                    $('body').on('click', function (e) {
                        if (!element.is(e.target) && element.has(e.target).length === 0 && $('.popover').has(e.target).length === 0)
                            element.popover('hide');
                    });
                }           
            }         
    
    });
    

    这似乎在 fullcalendar 中运行良好。

    谢谢。

    【讨论】:

      【解决方案2】:

      更简单:您可以将隐藏事件附加到实际元素本身:

      element.on('click', function() {
        element.popover('hide');
      };
      

      【讨论】:

        猜你喜欢
        • 2012-07-27
        • 1970-01-01
        • 2017-11-25
        • 1970-01-01
        • 2012-12-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多