add resize functionality to calendar

This commit is contained in:
rlx 2011-10-03 13:23:40 +00:00
parent 90085aaf2f
commit ea76fed699
2 changed files with 19 additions and 11 deletions

View file

@ -42,8 +42,8 @@ Ox.Calendar = function(options, self) {
.options(options || {}) .options(options || {})
.addClass('OxCalendar') .addClass('OxCalendar')
.css({ .css({
width: self.options.width + 'px', //width: self.options.width + 'px',
height: self.options.height + 'px' //height: self.options.height + 'px'
}) })
.bindEvent({ .bindEvent({
anyclick: function(e) { anyclick: function(e) {
@ -635,11 +635,12 @@ Ox.Calendar = function(options, self) {
} }
function getOverlayWidths() { function getOverlayWidths() {
var width = Math.round(self.options.width / getScrollbarFactor()); var width = that.width() || self.options.width,
centerWidth = Math.round(width / getScrollbarFactor());
return [ return [
Math.floor((self.options.width - width) / 2), Math.floor((width - centerWidth) / 2),
width, centerWidth,
Math.ceil((self.options.width - width) / 2), Math.ceil((width - centerWidth) / 2),
]; ];
} }
@ -1034,17 +1035,22 @@ Ox.Calendar = function(options, self) {
if (key == 'date') { if (key == 'date') {
} else if (key == 'height') { } else if (key == 'height') {
that.css({height: self.options.height + 'px'}); //that.css({height: self.options.height + 'px'});
} else if (key == 'width') { } else if (key == 'width') {
that.css({width: self.options.width + 'px'}); //that.css({width: self.options.width + 'px'});
self.$zoomInput.options({size: self.options.width}); //self.$zoomInput.options({size: self.options.width});
getLines(); //getLines();
renderCalendar();
} else if (key == 'zoom') { } else if (key == 'zoom') {
} }
}; };
that.resizeCalendar = function() {
self.$zoomInput.options({size: that.width()});
getLines();
renderCalendar();
};
return that; return that;
}; };

View file

@ -87,6 +87,8 @@ Ox.Checkbox = function(options, self) {
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'checked') { if (key == 'checked') {
that.toggleChecked(); that.toggleChecked();
} else if (key == 'title') {
self.$title.options({title: value});
} }
}; };