Properly set the width of each event when its placed on the schedule based on the size of the table cell its going into, and re-place all the events on window.resize :)

This commit is contained in:
james 2010-06-11 20:39:29 +00:00
parent 76f1a79fe7
commit 49f127dbd1

View File

@ -58,7 +58,7 @@
exit; exit;
} }
echo "<table class=\"schedule\">\n"; echo "<table class=\"schedule\" id=\"schedule\">\n";
echo "<tr>"; echo "<tr>";
echo "<th style=\"width: 50px;\">&nbsp;</th>"; echo "<th style=\"width: 50px;\">&nbsp;</th>";
foreach($locations AS $id=>$name) { foreach($locations AS $id=>$name) {
@ -171,6 +171,10 @@
} }
} }
}); });
$(window).resize(function() {
placeEvents();
}
);
}); });
function changeDate() { function changeDate() {
@ -194,11 +198,13 @@
var tablecellid=eventobj.hour+'_'+eventobj.minute+'_'+eventobj.location; var tablecellid=eventobj.hour+'_'+eventobj.minute+'_'+eventobj.location;
var eheight=((eventobj.duration/15)*<?=$ROWHEIGHT?>)-<? echo $BORDERSIZE*2; ?>; var eheight=((eventobj.duration/15)*<?=$ROWHEIGHT?>)-<? echo $BORDERSIZE*2; ?>;
var ewidth=$("#"+tablecellid).width()-<? echo $BORDERSIZE; ?>;
var p=$("#"+tablecellid).offset(); var p=$("#"+tablecellid).offset();
$("#"+item.id).css(p); $("#"+item.id).css(p);
$("#"+item.id).show(); $("#"+item.id).show();
$("#"+item.id).height(eheight); $("#"+item.id).height(eheight);
$("#"+item.id).width(ewidth);
} }
); );
} }