FullCalendar dayClick在我的项目中不起作用,直到用户退回或退回一个月然后回到当月。我继承了这个项目,之前没有日历函数的经验,所以我不知道从哪里开始,除了发布与其中一个日历相关的标记。我是StackOverflow的新手,所以如果我需要发布任何其他细节,请告诉我。提前感谢任何建议。
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PersonalCalendar.ascx.cs" Inherits="Controls_Events_PersonalCalendar" %>
<link id="lnkCSSFiles" type="text/css" media="screen, projection" rel="stylesheet" href="~/css/fullcalendar.css" runat="server" />
<div class="rightCol">
<div class="search masked formWhole">
<label for="searchBox">
Search</label>
<asp:TextBox ID="txtSearch" CssClass="text" runat="server" />
<asp:Button ID="btnSearch" CssClass="button" Text="Search" OnClick="btnSearch_Click"
runat="server" />
</div>
</div>
<div>
<asp:ListView ID="lsvSearch" runat="server">
<LayoutTemplate>
<h3>
Search Results</h3>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</LayoutTemplate>
<ItemTemplate>
<div class="eventList">
<a href="<%#((EventsWrapper)Container.DataItem).URL %>" class="eventTitle">
<%# ((EventsWrapper)Container.DataItem).Title%></a> <span class="eventDate">
<%# ((EventsWrapper)Container.DataItem).StartDate%></span> <span class="eventLocation">
in
<%# ((EventsWrapper)Container.DataItem).City%></span> <a class="more" href="<%#((EventsWrapper)Container.DataItem).URL %>">
View Event »</a>
</div>
</ItemTemplate>
</asp:ListView>
</div>
<div id="genWidget" class="calendarWidget" runat="server">
<div id="calendar">
</div>
</div>
<!--end Calendar Widget-->
<asp:Literal ID="litJavaScripts" Text="~/tft-js/core/fullcalendar.js,~/tft-js/core/jquery.dateformat.js,~/tft-js/jquery.tools.min.js" runat="server" />
<script type="text/javascript">
function outputAMPM(d) {
var date = new Date(d);
h = d.getHours();
if (h < 12)
return "AM";
return "PM";
}
$(document).ready(function () {
$("#calendar").fullCalendar({
<% if (m_Year.HasValue){ %>year: <%= m_Year.Value %>,<%} %>
<% if (m_Month.HasValue){ %>month: <%= m_Month.Value - 1 %>,<%} %>
events: '<%= ResolveClientUrl(Request.AppRelativeCurrentExecutionFilePath) + (!String.IsNullOrEmpty(Request.QueryString.ToString()) ? "?" + Request.QueryString.ToString() : "") %>',
header: {
left: 'prev,next title',
center: '',
right: ''
},
aspectRatio: 1.1,
titleLength: <%= TitleLength %>,
weekSelectURL: '<%= ResolveClientUrl("~/events.aspx") + m_DaylessQueryString + (!String.IsNullOrEmpty(m_DaylessQueryString) ? "&" : "?") %>',
weekMode: 'variable',
timeFormat: 'H(:mm)',
eventRender: function(event, element) {
element.append('<div class="eventPopup"><div class="popupWrapper"><span class="title">'+ event.title + '</span><span>' + $.format.date(event.start, "MM/dd/yyyy hh:mm") + outputAMPM(event.start) + '</span><span class="address">' + event.Address1+ '<br />' + event.Address2+ '<br />' + event.City + ', ' +event.State +' ' + event.Zip + '</span>' + '<a class="more" href="'+event.url +'">'+event.url +'</a><a class="more" href="all-events.aspx">View More</a><div class="clearfix"><div class="addthis_toolbox"><a class="addthis_button_facebook" addthis:url="'+ event.url +'" addthis:title="'+ event.title + '"></a><a class="addthis_button_tweet" tw:count="none"></a><a class="addthis_button_google_plusone" <%= "g:plusone:count=\"false\"" %>></a></div></div></div></div>');
},
eventAfterRender: function(event, element,view){
setTimeout(function(){
$('div.fc-event > a').tooltip().dynamic();
$('div.fc-event').hover(function() {
$(this).addClass('hoveredEvent');
},
function() {
$(this).removeClass('hoveredEvent');
}
);
},1000);
}
});
$(".fc-day-number").each(function(){
var num = $(this).find("a").html();
$(this).html(num);
});
});
</script>
<script type="text/javascript">
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5098045873d5139d"></script>
答案 0 :(得分:0)
我使用它时遇到了这个问题。这是因为代码没有用$(document).ready(function(){})编写。由于您已经这样做,请尝试指定默认视图。它。 如果可能,请创建http://www.jsfiddle.net