cooxie
cooxie

Reputation: 3044

jQuery FullCalendar: Disable scrolling in Agenda View?

How can I disable scrolling in the Agenda View (week, day mode) using the FullCalendar jQuery plug-in? In month mode everything is fine, but when I change to Week/Day mode there is a scrollbar next to my mainpage scrollbar.

Upvotes: 16

Views: 21146

Answers (5)

Ferenc Dajka
Ferenc Dajka

Reputation: 1051

just use:

$('#calendar').fullCalendar({
    height: "auto"
});

Upvotes: 6

Pavel Zubkou
Pavel Zubkou

Reputation: 835

Starting from FullCalendar 2.1.0-beta1, you can set { height: 'auto' } option to disable scrollbars in views.

Although changelog entry for this new functionality can be read as "To turn scrollbars off in month view", it actually works for all views.

In month view, when the calendar's height overflows because of too many events, vertical scrollbars will appear. To turn this behavior off, set the height option to 'auto'. -- from v2.1.0-beta1 changelog

Upvotes: 17

Alexxus
Alexxus

Reputation: 992

Here is an updated and shortened version of @Deulis answer:

$("#calendar").fullCalendar({
  viewRender: function(view){
    $("#calendar").fullCalendar("option", "contentHeight", (view.name === "month")? NaN : 9999);
  }
});

As @Pierre de LESPINAY and @Jens-André Koch already mentioned, viewDisplay is depricated in fullcalendar v2.0. We have to use viewRender instead.

Upvotes: 0

Deulis
Deulis

Reputation: 474

This was what I did in my case. The goal is to dynamically change the height, so I used the viewDisplay event in that way:

$('#calendar').fullCalendar({
    viewDisplay: function (view) {
        var h;
        if (view.name == "month") {
            h = NaN;
        }
        else {
            h = 2500;  // high enough to avoid scrollbars
        }

        $('#calendar').fullCalendar('option', 'contentHeight', h);
    }
});

Upvotes: 20

Sinetheta
Sinetheta

Reputation: 9449

Sure

$('#calendar').fullCalendar({
    height: 999999999
});

If your calendar has a scrollbar when you don't want it to then you have 3 options:

  1. make it big enough that it won't have a scroll bar
  2. shrink the content so that it fits within your coundaries
  3. remove the scrollbar and lose access to the information not shown

You need to be more specific than "I don't like scroll bars"

Upvotes: 3

Related Questions