leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.66k stars 659 forks source link

how to set the handle middle #1159

Closed Freelancedevani closed 2 years ago

Freelancedevani commented 3 years ago

how to set the handle middle without setting the start value 50.

currently I am making a scrollbar with this plugin. but problem is it's open with always start value .i dont want it. i want something like this , at first scroll start from 0 and the handle stay in the middle of the slider . how do i achieve it ?

here is my code

      let verticalBaseSlider = document.getElementById("baseControler");
      if (verticalBaseSlider) {
        noUiSlider.create(verticalBaseSlider, {
          start: 50,
          direction: "ltr",
          orientation: "vertical",
          connect: 'lower',
          animate: false,
          range: {
            min: 0,
            max: 100,
          },
        });

          verticalBaseSlider.noUiSlider.on("update", function (values, handle) {
            let panel = document.getElementById("four");
            let total = panel.scrollHeight - panel.offsetHeight;
            let percentage = total * (values[handle] / 100);
            panel.scrollTop = percentage;
        });

      }
leongersen commented 2 years ago

It isn't clear to me what you are asking here. Since you've also posted this question on stack overflow, we'll track it there.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.