From 987d029ba0815c7bf1e8788b5e5679c137710fd4 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Thu, 18 Feb 2010 21:10:53 -0800 Subject: [PATCH] fixed some small IE/FF scrolling and display bugs - in IE 6/7, gap underneath views, mouseover caused error - in FF, scrolling was sometimes set to top - in agenda views, scrolling would reset on every event rerender - during rendering of agenda view would cause document to get really tall --- src/agenda.js | 20 +++++++++++--------- src/grid.js | 2 +- src/main.js | 12 +++++++++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/agenda.js b/src/agenda.js index c1ecf30..ddfb2b3 100644 --- a/src/agenda.js +++ b/src/agenda.js @@ -200,7 +200,7 @@ function Agenda(element, options, methods) { body.find('td').click(slotClick); // slot event container - slotSegmentContainer = $("
").appendTo(bodyContent); + slotSegmentContainer = $("
").appendTo(bodyContent); // background stripes d = cloneDate(d0); @@ -269,15 +269,15 @@ function Agenda(element, options, methods) { body.scrollTop(timePosition(d0, scrollDate) + 1); // +1 for the border // TODO: +1 doesn't apply when firstHour=0 } - if ($.browser.opera) { + //if ($.browser.opera) { setTimeout(go, 0); // opera 10 (and earlier?) needs this - }else{ - go(); - } + //}else{ + // go(); + //} } - function setHeight(height) { + function setHeight(height, dontResetScroll) { viewHeight = height; slotTopCache = {}; @@ -290,7 +290,9 @@ function Agenda(element, options, methods) { height: height }); - resetScroll(); //TODO: not the best place for this + if (!dontResetScroll) { + resetScroll(); + } } @@ -303,7 +305,7 @@ function Agenda(element, options, methods) { var topTDs = head.find('tr:first th'), stripeTDs = bg.find('td'), - clientWidth = slotSegmentContainer.width(); // body[0].clientWidth isn't reliable here in IE6 + clientWidth = body[0].clientWidth; bodyTable.width(clientWidth); @@ -454,7 +456,7 @@ function Agenda(element, options, methods) { bindDaySegHandlers, modifiedEventId ); - setHeight(viewHeight); // might have pushed the body down, so resize + setHeight(viewHeight, true); // might have pushed the body down, so resize } } diff --git a/src/grid.js b/src/grid.js index 4ab6ec5..28bd0c8 100644 --- a/src/grid.js +++ b/src/grid.js @@ -211,7 +211,7 @@ function Grid(element, options, methods) { tbody = $(s + "").appendTo(table); tbody.find('td').click(dayClick); - segmentContainer = $("
").appendTo(element); // style='position:absolute;top:0;left:0' // made it a little slower for some reason + segmentContainer = $("
").appendTo(element); }else{ // NOT first time, reuse as many cells as possible diff --git a/src/main.js b/src/main.js index e18f0b2..ab02215 100644 --- a/src/main.js +++ b/src/main.js @@ -188,7 +188,9 @@ $.fn.fullCalendar = function(options) { if (v != viewName) { ignoreWindowResize++; - var oldView = view; + var oldView = view, + newViewElement; + if (oldView) { if (oldView.eventsChanged) { eventsDirty(); @@ -206,8 +208,9 @@ $.fn.fullCalendar = function(options) { } }else{ view = viewInstances[v] = $.fullCalendar.views[v]( - $("
").appendTo(content), - options); + newViewElement = $("
").appendTo(content), + options + ); } if (header) { @@ -218,6 +221,9 @@ $.fn.fullCalendar = function(options) { view.name = viewName = v; render(); + if (newViewElement) { + newViewElement.css('position', 'relative'); + } if (oldView) { content.css('overflow', ''); // needs to be first setMinHeight(content, 0);