another bugfix for calendar resizing + iframes

This commit is contained in:
Adam Shaw 2010-02-21 19:17:40 -08:00
parent d1d5419256
commit 229c9c31d8
2 changed files with 106 additions and 6 deletions

View file

@ -159,7 +159,8 @@ $.fn.fullCalendar = function(options) {
date = new Date(), date = new Date(),
viewName, // the current view name (TODO: look into getting rid of) viewName, // the current view name (TODO: look into getting rid of)
view, // the current view view, // the current view
viewInstances = {}; viewInstances = {},
absoluteViewElement;
@ -214,7 +215,9 @@ $.fn.fullCalendar = function(options) {
(view = viewInstances[v]).element.show(); (view = viewInstances[v]).element.show();
}else{ }else{
view = viewInstances[v] = $.fullCalendar.views[v]( view = viewInstances[v] = $.fullCalendar.views[v](
newViewElement = $("<div class='fc-view fc-view-" + v + "' style='position:absolute'/>").appendTo(content), newViewElement = absoluteViewElement =
$("<div class='fc-view fc-view-" + v + "' style='position:absolute'/>")
.appendTo(content),
options options
); );
} }
@ -226,10 +229,7 @@ $.fn.fullCalendar = function(options) {
} }
view.name = viewName = v; view.name = viewName = v;
render(); render(); // after height has been set, will make absoluteViewElement's position=relative, then set to null
if (newViewElement) {
newViewElement.css('position', 'relative');
}
content.css('overflow', ''); content.css('overflow', '');
if (oldView) { if (oldView) {
setMinHeight(content, 1); setMinHeight(content, 1);
@ -779,6 +779,10 @@ $.fn.fullCalendar = function(options) {
function setSize(dateChanged) { function setSize(dateChanged) {
ignoreWindowResize++; ignoreWindowResize++;
view.setHeight(suggestedViewHeight, dateChanged); view.setHeight(suggestedViewHeight, dateChanged);
if (absoluteViewElement) {
absoluteViewElement.css('position', 'relative');
absoluteViewElement = null;
}
view.setWidth(content.width(), dateChanged); view.setWidth(content.width(), dateChanged);
ignoreWindowResize--; ignoreWindowResize--;
} }

View file

@ -0,0 +1,96 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type='text/javascript' src='loader.js'></script>
<script type="text/javascript">
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
defaultView: 'agendaDay',
minTime: 0,
maxTime: 24,
firstDay: 1,
allDayText: "dieną",
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
],
header: {
left: 'prev',
center: 'title',
right: 'next next next'
},
allDaySlot: true,
editable: true,
titleFormat:
{
month: 'MMMM yyyy', // September 2009
week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}", // Sep 7 - 13 2009
day: 'dddd' // Tuesday, Sep 8, 2009
},
axisFormat: 'HH(:mm)',
timeFormat: { agenda: 'HH:mm{ - HH:mm}' },
weekends: true
});
});
</script>
<body>
<div id="calendar"> </div>
</body>
</html>