点击启动弹出事件未显示

Bootstrap popover on click event not showing

本文关键字:显示 出事件 启动      更新时间:2023-09-26

当我在完整日历中触发evenLimitClick事件时,我的popover不工作。它在我的dayClick事件中运行良好,但在我的事件LimitClick中没有发生任何事情。这是我的小提琴我甚至尝试将popover设置为在父对象上调用(例如$(this).Pparent().popover,但这也不起作用。

$(document).ready(function () {
    // page is now ready, initialize the calendar...
    var eventsArray = [{
        title: 'Test1',
        start: new Date()
    }, {
        title: 'Test2',
        start: new Date("2015-04-21")
    }, {
        title: 'Test3',
        start: new Date("2015-04-21")
    }];
    $('#calendar').fullCalendar({
        // put your options and callbacks here
        header: {
            left: 'prev,next', //today',
            center: 'title',
            right: ''
        },
        defaultView: 'month',
        editable: true,
        allDaySlot: false,
        selectable: true,
        events: eventsArray,
        eventLimit: 1,
        eventLimitClick: function (cellInfo, jsEvent) {
            $(this).popover({
                html: true,
                placement: 'bottom',
                container: 'body',
                title: function () {
                    return $("#events-popover-head").html();
                },
                content: function () {
                    return $("#events-popover-content").html();
                }
            });
            $(this).popover('show');
        },
        dayClick: function (cellInfo, jsEvent) {
            $(this).popover({
                html: true,
                placement: 'bottom',
                container: 'body',
                title: function () {
                    return $("#events-popover-head").html();
                },
                content: function () {
                    return $("#events-popover-content").html();
                }
            });
            $(this).popover('show');
        },
    })
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.3.1/fullcalendar.js"></script>
<div style="border:solid 2px red;">
    <div id='calendar'></div>
    <div id="events-popover-head" class="hide">Events</div>
    <div id="events-popover-content" class="hide">Test</div>
</div>

在事件中LimitClick事件更改如下:

$(this).popover

$(cellInfo.dayEl)

cellInfo.dayEl是要显示其popover的单击的Day单元格元素。

我也更新了Fiddle