Javascript 如何禁用日期控制按钮的FullCalendar onClick功能?

Javascript 如何禁用日期控制按钮的FullCalendar onClick功能?,javascript,jquery,fullcalendar,Javascript,Jquery,Fullcalendar,我希望有人对此有想法。我正在使用FullCalendar()插件。我在“prev”和“next”按钮中添加了额外的功能,以触发其他日历上的事件。在用户单击按钮转到上一个或下一个日期后,我希望该按钮禁用1-2秒。这就是我尝试过的 “prev”和“next”按钮的源代码如下所示: <td class="fc-header-left"> <span class="fc-button fc-button-next fc-state-default fc-corner-right" un

我希望有人对此有想法。我正在使用FullCalendar()插件。我在“prev”和“next”按钮中添加了额外的功能,以触发其他日历上的事件。在用户单击按钮转到上一个或下一个日期后,我希望该按钮禁用1-2秒。这就是我尝试过的

“prev”和“next”按钮的源代码如下所示:

<td class="fc-header-left">
<span class="fc-button fc-button-next fc-state-default fc-corner-right" unselectable="on"> 
  <span class="fc-text-arrow">›</span>
</span>
<span class="fc-button fc-button-prev fc-state-default fc-corner-left" unselectable="on">       
  <span class="fc-text-arrow">‹</span>
</span>
</td>

›
‹
我的代码:

$('.fc-button-prev span').click(function(){
    var spinner = createSpinner();
    $('.fc-button-prev').addClass('fc-state-disabled');
    $('.fc-button-next').addClass('fc-state-disabled');
    $('.fc-button-prev span').onclick = null;
    $('.fc-button-next span').onclick = null;
    setTimeout(function() {
      <% @doctors.each do |doctor| %>
          $('#calendar_<%= doctor.id %>').fullCalendar('prev');
      <% end %>
      $('.fc-button-prev').removeClass('fc-state-disabled');
      $('.fc-button-next').removeClass('fc-state-disabled');

      spinner.stop();
    }, 2000);

});
$('.fc按钮上一个span')。单击(函数(){
var spinner=createSpinner();
$('.fc button prev').addClass('fc-state-disabled');
$('.fc button next').addClass('fc-state-disabled');
$('.fc button prev span')。onclick=null;
$('.fc button next span')。onclick=null;
setTimeout(函数(){
$('日历').fullCalendar('prev');
$('.fc button prev').removeClass('fc-state-disabled');
$('.fc button next').removeClass('fc-state-disabled');
spinner.stop();
}, 2000);
});
这不起作用,每次用户单击按钮时,都会出现新的微调器。若用户在一秒钟内点击按钮3次,将显示三个微调器。此外,超时后,日历将向前或向后跳转三天


谢谢您的帮助。

我使用以下代码将其禁用了2秒钟:

 $(function () {
            $('.fc-button-prev').click(disableNextPrev);
            $('.fc-button-next').click(disableNextPrev);
        });

        function disableNextPrev()
        {
            $('.fc-button-prev').addClass('fc-state-disabled');
            $('.fc-button-next').addClass('fc-state-disabled');
            myVar = setTimeout(function () {
                // your custom code goes here
                //.... 

                 $('.fc-button-prev').removeClass('fc-state-disabled');
                 $('.fc-button-next').removeClass('fc-state-disabled');
                 clearTimeout(myVar);

             }, 2000);
        }