Skip to content

Commit ac38588

Browse files
sliderAccess tweak
1 parent cc45f6a commit ac38588

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -639,20 +639,22 @@ $.extend(Timepicker.prototype, {
639639
if (this._defaults.addSliderAccess){
640640
var sliderAccessArgs = this._defaults.sliderAccessArgs;
641641
setTimeout(function(){ // fix for inline mode
642-
$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-
if(sliderAccessWidth){
647-
$tp.find('table:visible').each(function(){
648-
var $g = $(this),
649-
oldWidth = $g.outerWidth(),
650-
oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
651-
newWidth = oldWidth - sliderAccessWidth,
652-
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
642+
if($tp.find('.ui-slider-access').length == 0){
643+
$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
644+
645+
// fix any grids since sliders are shorter
646+
var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
647+
if(sliderAccessWidth){
648+
$tp.find('table:visible').each(function(){
649+
var $g = $(this),
650+
oldWidth = $g.outerWidth(),
651+
oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
652+
newWidth = oldWidth - sliderAccessWidth,
653+
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
653654

654-
$g.css({ width: newWidth, marginLeft: newMarginLeft });
655-
});
655+
$g.css({ width: newWidth, marginLeft: newMarginLeft });
656+
});
657+
}
656658
}
657659
},0);
658660
}

0 commit comments

Comments
 (0)