datepicker: prev/next buttons were bumping in disabled state due to :hover rules in the stylesheet, fixed by adding ui-datepicker-prev/next-hover classes, fixes #3774

This commit is contained in:
Paul Bakaus 2009-01-07 16:55:50 +00:00
parent f48f615ec0
commit 5eca84265f
2 changed files with 8 additions and 4 deletions

View File

@ -3,11 +3,11 @@
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
.ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker-prev, .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker-prev:hover, .ui-datepicker-next:hover { top: 1px;}
.ui-datepicker-prev-hover, .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker-prev { left:2px; }
.ui-datepicker-next { right:2px; }
.ui-datepicker-prev:hover { left:1px; }
.ui-datepicker-next:hover { right:1px; }
.ui-datepicker-prev-hover { left:1px; }
.ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }

View File

@ -580,11 +580,15 @@ $.extend(Datepicker.prototype, {
.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
.bind('mouseout', function(){
$(this).removeClass('ui-state-hover');
if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
})
.bind('mouseover', function(){
if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
$(this).addClass('ui-state-hover');
if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
}
})
.end()
@ -1303,7 +1307,7 @@ $.extend(Datepicker.prototype, {
var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
var firstDay = parseInt(this._get(inst, 'firstDay'));
var firstDay = parseInt(this._get(inst, 'firstDay'),10);
firstDay = (isNaN(firstDay) ? 0 : firstDay);
var dayNames = this._get(inst, 'dayNames');
var dayNamesShort = this._get(inst, 'dayNamesShort');