Skip to content

Commit f9a9344

Browse files
Fix grids with sliderAccess
1 parent f4ace05 commit f9a9344

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ $.extend(Timepicker.prototype, {
435435

436436
for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
437437
millisecGridSize++;
438-
html += '<td>' + ((l < 10) ? '0' : '') + s + '</td>';
438+
html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
439439
}
440440

441441
html += '</tr></table></div>';
@@ -640,8 +640,21 @@ $.extend(Timepicker.prototype, {
640640
var sliderAccessArgs = this._defaults.sliderAccessArgs;
641641
setTimeout(function(){ // fix for inline mode
642642
$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
643+
644+
// fix any grids since sliders are shorter
645+
var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
646+
$tp.find('table:visible').each(function(){
647+
var $g = $(this),
648+
oldWidth = $g.outerWidth(),
649+
oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
650+
newWidth = oldWidth - sliderAccessWidth,
651+
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
652+
653+
$g.css({ width: newWidth, marginLeft: newMarginLeft });
654+
});
643655
},0);
644656
}
657+
// end slideAccess integration
645658
}
646659
},
647660

0 commit comments

Comments
 (0)