2016-09-23 42 views
-1

今天按鈕的今天按鈕開酥料餅在默認情況下禁用讓它先活動。(Fullcalendar, Make Today Button for current month activeFullcalendar,當點擊當前日期

在下面的代碼我顯示如何打開當前日期的酥料餅當點擊今日按鈕。

在腳本文件中寫下面的代碼。

$(document).on('click', '.fc-today-button', function(){ 
       $('#fc-more-'+moment().format('YYYY-MM-DD')).click(); 
     }); 

修改Fullcaldar renderMoreLink(),在renderMoreLink下面添加行()

renderMoreLink: function(cell, hiddenSegs){ 
var custom = moment(cell.start).format('YYYY-MM-DD'); // custsom code 
return $('<a class="fc-more" id="fc-more-'+custom+'"/>') added id in <a> 
} 

回答

0

今天按鈕默認禁用讓它先活動。 Click here for making today button active

在下面的代碼中,我展示瞭如何在點擊今天按鈕時打開當前日期的彈出窗口。

在腳本文件中寫下面的代碼。

$(document).on('click', '.fc-today-button', function(){ 
      $('#fc-more-'+moment().format('YYYY-MM-DD')).click(); 
    }); 

修改Fullcaldar renderMoreLink()中,添加以下行renderMoreLink()

renderMoreLink: function(cell, hiddenSegs){ 
var custom = moment(cell.start).format('YYYY-MM-DD'); // custsom code 
    return $('<a class="fc-more" id="fc-more-'+custom+'"/>') //added custom id attribute 
    }