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

Larger clickable area when slider is small #1172

Closed AAverin closed 2 years ago

AAverin commented 2 years ago

When slider itself is very small with tap behavior set, it would be great to somehow set tappable area larger so that user could click around the slider and pips would still move. See image for reference.

image

leongersen commented 2 years ago

You can do this by making .noUi-base larger. For the default styling, that'd look like this:

.noUi-base {
    height: 200%;
}
.noUi-connects {
    height: 50%;
}

You can center this tap area by pulling it up, and pushing the connect elements and handles down:

.noUi-base {
    top: -8px;
}
.noUi-connects
.noUi-origin {
    top: 8px
}
AAverin commented 2 years ago

Thanks, it worked nicely

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.