在我的导航栏之前加载完整日历

时间:2018-04-03 10:48:46

标签: html css razor fullcalendar

使用FullCalendar与我的C#ASP.net应用程序有一个奇怪的问题。当我加载FullCalendar时,我的导航栏没有正确响应。加载日历后,我无法访问下拉列表。

Pic of Problem

我认为这与我在导航栏前加载FullCalendar有关,但我不知道。这是我的剃刀页面,用于执行我的日历。

<div id="calendar"></div>

<div id="myModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title"><span id="eventTitle"></span></h4>
            </div>
            <div class="modal-body">
                <button id="btnDelete" class="btn btn-default btn-sm pull-right">
                    <span class="glyphicon glyphicon-remove"></span> Remove
                </button>
                <button id="btnEdit" class="btn btn-default btn-sm pull-right" style="margin-right:5px;">
                    <span class="glyphicon glyphicon-pencil"></span> Edit
                </button>
                <p id="pDetails"></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>


<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.print.css" rel="stylesheet" media="print" />

@section Scripts{
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>

    <script>
        $(document).ready(function () {
            var events = [];
            $.ajax({
                type: "GET",
                url: "/Appointments/GetEvents",
                success: function (data) {
                    $.each(data, function (i, v) {
                        events.push({
                            details: v.DetailsOfAppointment,
                            date: moment(v.DateOfAppointment),
                            room: v.RoomType,
                            confirmed: v.Confirmed,
                            colour: v.ThemeColour,
                            church: v.Church.Name,
                            parishAdminName: v.Admins.AdministratorName,
                            parishAdminUser: v.Admins.AdminUsername,
                            parishAdminId: v.Admins.AdministratorId,
                            fee: v.Fee,
                            id: v.AppointmentId
                        });

                    })
                     GenerateCalender(events);   
                },
                error: function (error) {
                    alert("failed");
                    console.log(error);
                }
            })

            function GenerateCalender(events) {
                $('#calendar').fullCalendar('destroy');
                $('#calendar').fullCalendar({
                    contentHeight: 500,
                    defaultDate: new Date(),
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,basicWeek,basicDay'
                    },
                    timeFormat: 'HH:mm',
                    eventLimit: true,
                    eventColor: events.ThemeColour,
                    events: events,
                    eventRender: function (event, element) {
                        if (event.fee == null) {
                            if (event.confirmed == false) {
                                element.css('background-color', '#FF0000');
                                element.css('border-color', '#FF0000');
                            }
                            else {
                                element.css('background-color', '#008000');
                                element.css('border-color', '#008000');
                            }
                        }
                        else
                        {
                            element.css('background-color', '#0000FF');
                            element.css('border-color', '#0000FF');

                        }
                    },
                    eventClick: function (calEvent, jsEvent, view) {
                        $('#myModal #details').text(calEvent.details);
                        var $details = $('<div/>');

                        if (calEvent.fee != null) {
                            $details.append($('<p/>').html('<b>Date of Ceremony : </b>' + calEvent.date.format("DD-MMM-YYYY HH:mm a")));
                        }
                        else {
                            $details.append($('<p/>').html('<b>Date of Appointment : </b>' + calEvent.date.format("DD-MMM-YYYY HH:mm a")));
                        }
                        if (calEvent.end != null) {
                            $details.append($('<p/>').html('<b>End:</b>' + calEvent.end.format("DD-MMM-YYYY HH:mm a")));
                        }
                        $details.append($('<p/>').html('<b>Details : </b>' + calEvent.details));
                        $details.append($('<p/>').html('<b>Church Name : </b>' + calEvent.church));
                        if (calEvent.fee == null) {
                            if (calEvent.room != null) {
                                $details.append($('<p/>').html('<b>Room : </b>' + calEvent.room));
                            }
                            else {
                                $details.append($('<p/>').html('<b>Room Not Confirmed'));
                            }
                        }


                        $details.append($('<p/>').html('<b>Parish Admin : </b>' + calEvent.parishAdminName));
                        if (calEvent.confirmed == true)
                        {
                            $details.append($('<p/>').html('<b>Status : Confirmed </b>'));
                        }
                        else
                        {
                            $details.append($('<p/>').html('<b>Status : Not Confirmed </b>'));
                        }
                        $('#myModal #pDetails').empty().html($details);

                        $('#myModal').modal();
                    }

                })
            }
        })
    </script>
}

1 个答案:

答案 0 :(得分:0)

这似乎是z-index问题。确保您的元素已定位(例如relative)并添加z-index属性,例如:z-index: 99; 有关它的更多信息,请参见MDN documentation: