Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Maxm on Sep 17, 2009 03:12
open dhtmlx forum
DHTMLX Slider - reverse direction.

Hi

A minor question - is it possible to make Slider to work in opposite direction. I.e. when drag to the left value should increase.

I have tried to set minValue(100) maxValue(1) - it did the trick if to use only slider - but if I try to enter sth into linked input - it behaves "crazy".

Thanks in advance!

Max.
Answer posted by Alex (support) on Sep 17, 2009 08:29

Hello, 

it is possible using onChange event. For example:
 

var maxValue = 100; //slider max value
var linkedInput = document.getElementById ('input1'); // manually link the slider with an input box
  
slider.attachEvent ("onChange", 
  function (value) {
  var newValue = maxValue - value //get opposite value
  linkedInput.value = newValue; //set new value to the linked input box
  this._setTooltip (newValue); //set new tooltip
  }
  );
 slider.init();
 slider.enableTooltip (false); //disable default tooltip value

Answer posted by Max on Sep 18, 2009 08:40
Thanks Alex.