2014-02-23 106 views
0

我使用的是jQuery 1.7.2和Full Calender 1.6.4。现在我试图添加点击事件和双击事件,但我无法成功。jQuery完整日历渲染事件

我尝试以下解决办法,但它在FF工作,但在IE浏览器无法正常工作

eventRender: function (event, element) { 
    element.bind('click', function() { 
     var doubleClickOpportunity = 200, // Adjust this to whatever feels right 
     clicker = element.data('clicker'); // Holder for the doubleclick setTimeout 


     if (clicker) { 
     // If there's a setTimeout stored in clicker, then this is a double click 
     clearTimeout(clicker); 
     element.data('clicker', ''); 
     element.trigger('doubleclick'); 
     } else { 
     // Otherwise, it's either a single click or the beginning of a double click 

     // So set a timer to decide which it is - if the timer runs out, 
     // it's just a single click. 
     element.data('clicker', setTimeout(function() { 
      element.data('clicker', ''); 
      element.trigger('singleclick'); 
     }, doubleClickOpportunity)); 
     } 
    }); 
    element.bind('doubleclick', function (e) {//dblclick 
     if (!confirm(Res.deleteEvent)) 
     return false; 


     $('#calendar').fullCalendar('removeEvents', event.id); 
    }); 
    element.bind('singleclick', function (e) { 
     alert("I am click"); 
    }); 
    } 

回答

0

检查此链接Milind:

这是绑定一个滚动事件日历也许它会帮助你做你想做的事。

Fullcalendar mousewheel bind event

注意,在Firefox结合事件是从铬/ IE不同。

+0

首先感谢您的回复,我不能使用mousewheel事件,我的网站可以用在手机或平板电脑上。所以这可能会对这些用户造成某种限制 – Milind

+0

当然,但意味着您需要对代码进行分析,以便帮助您完成事件绑定。我想让你看到绑定,例如对div /元素的onclick事件与chrome和firefox不同。 –