How to fix jQuery UI slider by displaying a negative value

enter image description here JQuery UI slider Sometimes a -1value is displayed in firefox 10.0.2 How to fix this?

The problem is demonstrating the source site of the jqueryui.com/demos/slider/range.html plugin

+5
source share
3 answers

Its a bug with the jQuery UI library .. others have also reported this with version 1.8.16 .. you can see it here http://bugs.jqueryui.com/ticket/8108

According to the comments in the thread, I checked it with 1.8.17 and it works fine .. it seems like the error was introduced in 1.8.18 ..

Try changing the files to version 1.8.17 .. it should work!

+2

Firefox 10.0.2 OS X , jQuery UI 1.8.16, 1.8.17 1.8.18, , , Anz .

- , , , :

function SlideFunction(sSlider, ui) {
    if (ui.value == -1) {
        ui.value = 0;
    };
    $(sSlider).val(ui.value);
};

sSlider - , .

+2

, , , :

$(function() {
  $( "#slider-range" ).slider({
    range: true,
    min: 0,
    max: 500,
    values: [ 75, 300 ],
    slide: function( event, ui ) {
      $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
      checkValues(ui.values[ 0 ], ui.values[ 1 ]);
    }
  });
  $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + " - $" + $( "#slider-range" ).slider( "values", 1 ) );

  function checkValues(valOne, valTwo){
    if (valOne == -1){
      $( "#amount" ).val( "$0 - $" + valTwo );
      $('.ui-state-active').removeClass('ui-state-active');
    }
  };
});

, . - http://www.alsdev.co.uk/slider. . , 10 , "-1".

, .

-2

All Articles