锚链接在 FullCalendar 的周和日视图中不起作用
Anchor links not working in Week & Day view in FullCalendar
我正在使用 FullCalendar 3.5.1
我的事件是通过 eventRender 通过在事件数据上注入一些链接来呈现的。这些链接适用于月视图。但是当我切换到周视图或日视图时,这些链接是不可点击的。
我在这里放了一个jsfiddle https://jsfiddle.net/y8d0v6o3/1/
在 fiddle 月视图中抛出控制台错误,但那是因为并非所有功能都在 fiddle 上,但这也意味着链接正在被点击。在 Day/Week 视图中甚至没有错误。
eventRender: function(event, element, view) {
element.find(".fc-title").remove();
//element.find(".fc-time").remove();
$(element).css("margin-top", "3px");
$(element).addClass('event-on-' + event.start.format('YYYY-MM-DD'));
var wsTitleStyle = 'class="titlelinkConfirm"';
if(event.autoscheduled){
wsTitleStyle = 'class="titlelinkAutoSchd"';
}
if(event.missed){
//if missed change title color
wsTitleStyle = 'class="titlelinkMissed"';
}
var pbSurveyFlag = event.isSurvey ? 2 : 1;
if(event.title == 'ZZZZXXXYYY'){
event.eventBorderColor = '#FFF';
var wsMomentDate = event.start.format('YYYY-MM-DD');
var new_description ='<br/><a class="alink" href="javascript:calDetails('+ '''+'audits-appt-day.cfm' + '''+',500,400,' + '''+event.encryptedStart +''' +',' + '''+ 'dayView' + ''' + ','+'0' +')">'
+ 'Details' + '</a>' + ' '
+ '<a class="alink" href="javascript:calDetails('+ '''+'audits-mapDay.cfm' + '''+',800,600,' + '''+event.encryptedStart +''' +',' + '''+ 'dayView' + ''' +',' + ''' + wsMomentDate +''' +')">'
+ '<strong>Map Day</strong>' + '</a>'
;
element.append(new_description);
//do not allow this to be dragged
event.editable = false;
}else{
if (event.autoscheduled && !event.missed){
slink = '<a class="alink" href="javascript:doConfirmCal(' + '''+ event.auditID+'''+','+event.eventID+')">Confirm</a>';
} else if(!event.missed){
slink = '<a class="alink" href="javascript:popupReDirectEncryptedURL('+ '''+ 'auditID=' + event.auditID +'&missed='+ event.eventID +'&type=' + pbSurveyFlag+ '''+',' + '''+ 'ticket-progress.cfm' +''' + ',' + '800,500,'+ '''+'apptLetter' + '''+')">Missed</a>';
}
var new_description = '<a ' +wsTitleStyle+ ' href="javascript:LoadApptPage(' + event.eventID +',' + pbSurveyFlag +')">'
+ event.title + '</a><br/><br/>'
+ '<a class="alink" href="javascript:LoadFlexPage(' + ''' + event.auditID + ''' +',' + '''+pbSurveyFlag +''' +')">'
+ 'View' + '</a>' + ' '
+ slink
+ '<br/>' + ' ' + '<a class="alink" href="admin-timeTracking.cfm?isSurvey=' +pbSurveyFlag+'&auditID=' + event.auditID +'&date='+event.encryptedStart +'">'
+ 'Submit Time' + '</a>'
;
element.append(new_description);
}
}
我发现是z-index的问题。 Fullcalendar.css 将 z-index 添加到它的 css 元素。所以我加了
postion:relative;
我的锚标签 css 上的 z-index 足够高,这解决了问题。
我正在使用 FullCalendar 3.5.1
我的事件是通过 eventRender 通过在事件数据上注入一些链接来呈现的。这些链接适用于月视图。但是当我切换到周视图或日视图时,这些链接是不可点击的。 我在这里放了一个jsfiddle https://jsfiddle.net/y8d0v6o3/1/ 在 fiddle 月视图中抛出控制台错误,但那是因为并非所有功能都在 fiddle 上,但这也意味着链接正在被点击。在 Day/Week 视图中甚至没有错误。
eventRender: function(event, element, view) {
element.find(".fc-title").remove();
//element.find(".fc-time").remove();
$(element).css("margin-top", "3px");
$(element).addClass('event-on-' + event.start.format('YYYY-MM-DD'));
var wsTitleStyle = 'class="titlelinkConfirm"';
if(event.autoscheduled){
wsTitleStyle = 'class="titlelinkAutoSchd"';
}
if(event.missed){
//if missed change title color
wsTitleStyle = 'class="titlelinkMissed"';
}
var pbSurveyFlag = event.isSurvey ? 2 : 1;
if(event.title == 'ZZZZXXXYYY'){
event.eventBorderColor = '#FFF';
var wsMomentDate = event.start.format('YYYY-MM-DD');
var new_description ='<br/><a class="alink" href="javascript:calDetails('+ '''+'audits-appt-day.cfm' + '''+',500,400,' + '''+event.encryptedStart +''' +',' + '''+ 'dayView' + ''' + ','+'0' +')">'
+ 'Details' + '</a>' + ' '
+ '<a class="alink" href="javascript:calDetails('+ '''+'audits-mapDay.cfm' + '''+',800,600,' + '''+event.encryptedStart +''' +',' + '''+ 'dayView' + ''' +',' + ''' + wsMomentDate +''' +')">'
+ '<strong>Map Day</strong>' + '</a>'
;
element.append(new_description);
//do not allow this to be dragged
event.editable = false;
}else{
if (event.autoscheduled && !event.missed){
slink = '<a class="alink" href="javascript:doConfirmCal(' + '''+ event.auditID+'''+','+event.eventID+')">Confirm</a>';
} else if(!event.missed){
slink = '<a class="alink" href="javascript:popupReDirectEncryptedURL('+ '''+ 'auditID=' + event.auditID +'&missed='+ event.eventID +'&type=' + pbSurveyFlag+ '''+',' + '''+ 'ticket-progress.cfm' +''' + ',' + '800,500,'+ '''+'apptLetter' + '''+')">Missed</a>';
}
var new_description = '<a ' +wsTitleStyle+ ' href="javascript:LoadApptPage(' + event.eventID +',' + pbSurveyFlag +')">'
+ event.title + '</a><br/><br/>'
+ '<a class="alink" href="javascript:LoadFlexPage(' + ''' + event.auditID + ''' +',' + '''+pbSurveyFlag +''' +')">'
+ 'View' + '</a>' + ' '
+ slink
+ '<br/>' + ' ' + '<a class="alink" href="admin-timeTracking.cfm?isSurvey=' +pbSurveyFlag+'&auditID=' + event.auditID +'&date='+event.encryptedStart +'">'
+ 'Submit Time' + '</a>'
;
element.append(new_description);
}
}
我发现是z-index的问题。 Fullcalendar.css 将 z-index 添加到它的 css 元素。所以我加了 postion:relative;
我的锚标签 css 上的 z-index 足够高,这解决了问题。