slider icon indicating copy to clipboard operation
slider copied to clipboard

Fit handle within bounds

Open mrleblanc101 opened this issue 1 year ago • 2 comments

How do we fit handle within the slider bound ?

Screenshot 2024-03-11 at 3 54 58 PM

No-ui slider has an exemple for this here

Screenshot 2024-03-11 at 3 55 05 PM But adding padding like in the exemple doesn't seem to work.

mrleblanc101 avatar Mar 11 '24 19:03 mrleblanc101

By using the padding trick above, it looks like it is working at firs; the handle is aligned with the label. Screenshot 2024-03-11 at 4 03 41 PM

But once you move the handle, you see that the background of the slider is not aligned properly. Screenshot 2024-03-11 at 4 03 48 PM

mrleblanc101 avatar Mar 11 '24 20:03 mrleblanc101

Seems like the noUiSlider doc was missing some things. I found this issue: https://github.com/leongersen/noUiSlider/issues/1160#issuecomment-915094766 The fix is to move the background and radius on the parent.

.slider-horizontal {
    padding: 0 8px;
    background-color: var(--slider-bg);
    border-radius: var(--slider-radius);
    .slider-connects {
        margin: 0 -8px;
        width: calc(100% + 16px);
    }
}

mrleblanc101 avatar Mar 11 '24 20:03 mrleblanc101