开发者

Can firstHour be called like a method in FullCalendar

开发者 https://www.devze.com 2023-03-17 15:21 出处:网络
When creating the fullCalendar I can set firstHour and have it scroll to that hour, but I only want this to happen when the current d开发者_如何学运维ay is today. If the user goes to the next day, I w

When creating the fullCalendar I can set firstHour and have it scroll to that hour, but I only want this to happen when the current d开发者_如何学运维ay is today. If the user goes to the next day, I want the scrollbar to be at the top of the container, but if they come back to today I want it to go to the firstHour again.

Is there a way to call firstHour like a method? Or is there another way to achieve this?


You can check what day you are currently showing with the viewDisplay callback. But as far as I know you can't change the firstHour option after you have initialized the calendar. You will have to destroy it and then build it again...

viewDisplay: function(view) {
    if (view.start.toDateString() === new Date().toDateString()){
        alert('Currently showing today!');
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号