slider_bar,
handle_press,
popupEnabledAttr,
- icon;
+ icon,
+ text_right,
+ text_left;
// apply jqm slider
inputElement.slider();
break;
case 'text':
+ text_left = ( inputElement.attr('data-text-left') === undefined ) ? '' : inputElement.attr('data-text-left').substring( 0, 3 );
+ text_right = ( inputElement.attr('data-text-right') === undefined ) ? '' : inputElement.attr('data-text-right').substring( 0, 3 );
slider.before( $('<div class="ui-slider-left-text">' +
'<span style="position:relative;top:0.4em;">' +
- inputElement.attr('data-text-left').substring( 0, 3) +
+ text_left +
'</span></div>') );
slider.after( $('<div class="ui-slider-right-text">' +
'<span style="position:relative;top:0.4em;">' +
- inputElement.attr('data-text-right').substring( 0, 3) +
+ text_right +
'</span></div>') );
break;
}
var dstOffset = this.handle.offset();
this.popup.offset({
- left: dstOffset.left + ( this.handle.width() - this.popup.width() ) / 2,
- top: dstOffset.top - this.popup.outerHeight() + 15
+ left: dstOffset.left + ( this.handle.width() - this.popup.width() ) / 2
});
this.handle_press.offset({
// show value on the handle and in popup
updateSlider: function () {
var font_size,
+ padding_size,
newValue;
- if ( this.popupVisible ) {
- this.positionPopup();
- }
-
// remove the title attribute from the handle (which is
// responsible for the annoying tooltip); NB we have
// to do it here as the jqm slider sets it every time
newValue = this.element.val();
+ if ( this.popupVisible ) {
+ this.positionPopup();
+
+ if ( newValue > 999 ) {
+ font_size = '0.8rem';
+ padding_size = '0.5rem';
+ } else if ( newValue > 99 ) {
+ font_size = '1rem';
+ padding_size = '0.5rem';
+ } else {
+ font_size = '1.5rem';
+ padding_size = '0.15rem';
+ }
+
+ this.popup.css({
+ "font-size": font_size,
+ "padding-top": padding_size
+ });
+ }
+
if ( newValue === this.currentValue ) {
return;
}
if ( newValue > 999 ) {
- font_size = '0.7em';
+ font_size = '0.5rem';
} else if ( newValue > 99 ) {
- font_size = '0.8em';
+ font_size = '0.7rem';
} else if ( newValue > 9 ) {
- font_size = '0.9em';
+ font_size = '0.85rem';
} else {
- font_size = '1em';
+ font_size = '0.95rem';
}
if ( font_size != this.handleText.css('font-size') ) {