From c9ef0951bcd0adcf8d6543046d7b0575b1d347d4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 21 Jun 2015 23:42:55 -0700 Subject: [PATCH] Clear scrollbars on window resize --- src/UI/Calendar/CalendarView.js | 43 ++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/UI/Calendar/CalendarView.js b/src/UI/Calendar/CalendarView.js index 04ef9bdfe..b76859fc0 100644 --- a/src/UI/Calendar/CalendarView.js +++ b/src/UI/Calendar/CalendarView.js @@ -45,23 +45,6 @@ module.exports = Marionette.ItemView.extend({ element.find('.fc-day-grid-container').css('height', ''); }, - _eventAfterAllRender : function () { - if ($(window).width() < 768) { - this.$('.fc-center').show(); - this.$('.calendar-title').remove(); - - var title = this.$('.fc-center').html(); - var titleDiv = '
{0}
'.format(title); - - this.$('.fc-toolbar').before(titleDiv); - this.$('.fc-center').hide(); - } - - // Remove height from calendar so we don't have another scroll bar - this.$('.fc-day-grid-container').css('height', ''); - this.$('.fc-row.fc-widget-header').attr('style', ''); - }, - _eventRender : function(event, element) { element.addClass(event.statusLevel); element.children('.fc-content').addClass(event.statusLevel); @@ -113,6 +96,25 @@ module.exports = Marionette.ItemView.extend({ } }, + _eventAfterAllRender : function () { + if ($(window).width() < 768) { + this.$('.fc-center').show(); + this.$('.calendar-title').remove(); + + var title = this.$('.fc-center').html(); + var titleDiv = '
{0}
'.format(title); + + this.$('.fc-toolbar').before(titleDiv); + this.$('.fc-center').hide(); + } + + this._clearScrollBar(); + }, + + _windowResize : function () { + this._clearScrollBar(); + }, + _getEvents : function(view) { var start = moment(view.start.toISOString()).toISOString(); var end = moment(view.end.toISOString()).toISOString(); @@ -214,6 +216,7 @@ module.exports = Marionette.ItemView.extend({ viewRender : this._viewRender.bind(this), eventRender : this._eventRender.bind(this), eventAfterAllRender : this._eventAfterAllRender.bind(this), + windowResize : this._windowResize.bind(this), eventClick : function(event) { vent.trigger(vent.Commands.ShowEpisodeDetails, { episode : event.model }); } @@ -262,5 +265,11 @@ module.exports = Marionette.ItemView.extend({ title : tooltip, container : '.fc-content-skeleton' }); + }, + + _clearScrollBar : function () { + // Remove height from calendar so we don't have another scroll bar + this.$('.fc-day-grid-container').css('height', ''); + this.$('.fc-row.fc-widget-header').attr('style', ''); } }); \ No newline at end of file