Cha*_*han 2 javascript jquery fullcalendar
我添加一个javascript来抓住用户点击prev按钮(获取该月份的数据)
$(".fc-prev-button span").click(function(){
var view = $('#calendar').fullCalendar('getView');
console.log("The view's title is " + view.intervalStart.format());
console.log("The view's title is " + view.name);
return false;
});
Run Code Online (Sandbox Code Playgroud)
但每次用户点击,它会记录3次,意味着点击按钮,3次调用该功能,如果有办法只需拨打1次?
或者任何人都有更好的想法来处理用户点击上一个/下一个按钮?
更好地利用内置事件来获取数据.你可以听取viewRender并得到这样的数据:
$("#calendar").fullCalendar({
viewRender: function(view, element) {
console.log("The view's title is " + view.intervalStart.format());
console.log("The view's title is " + view.name);
}
});
Run Code Online (Sandbox Code Playgroud)
这可能会避免你的问题.
| 归档时间: |
|
| 查看次数: |
5907 次 |
| 最近记录: |