IonDen / ion.rangeSlider

jQuery only range slider
http://ionden.com/a/plugins/ion.rangeSlider/en.html
MIT License
2.56k stars 508 forks source link

onBegin callback #705

Closed straps closed 4 years ago

straps commented 4 years ago

In additional to onFinish, I needed and added a callback called when dragging start called onBegin

A tried to respect your code standards, please take a look at it, can be useful to others too , thanks

IonDen commented 4 years ago

Hi @straps, this functionality is redundant and adds too much code to slider. In fact this method was not included in to original set of methods, because it is super easy to emulate it:

// set this boolean variable to true
let onBegin = true;

...

// in slider config, in onChange callback check if it is true
onChange: function (data) {
  if (onBegin) {
    onBegin = false;
    // this is on begin callaback
  }
},
onFinish: function (data) {
  // set it back to true
  onBegin = true;
}

So, as you see, no need to have this method.

straps commented 4 years ago

I don't agree because is not so immediate (set a variable named onBegin inside an onFinish???) and I will keep working with my fork, but anyway, thanks for reply.

IonDen commented 4 years ago

As you see, let onBegin = true; was set outside.