Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
HTML5/JS Slider Range Bar: Only allow click events, no touchdown/mousedown

I have a problem with the slider bar from HTML5 using bootstrap css/js.

Especially the mobile view has a lot of control elements, so it requires scrolling up/down. This also works quite well. Unfortunately the slider bar triggers when scrolling so the slider changes value.

With buttons etc. this is easy with scrolling, if not clicked a button usually does not trigger.

Can this behavior also be implemented for slider bars? Otherwise, with each scroll operation with the finger, the slider accidentally assumes a new value.

This is the code for the Slider bar:

<label for="customRange-1" class="form-label">[LABEL]</label>
<input type="range" class="form-range" min="0" max="10" id="customrange-1">

To catch changes I use this JavaScript:

$('input[type=range]').on('input', function () { 
// some actions
)};

I tried to disable touchdown events:

$('input[type=range]').on('touchdown', function (e) {
    e.preventDefault();
});

But the problem is that the value can't be changed anymore. I only want to allow 'click' similar 'touch' events, but no touchdown-hold events used for scrolling a page.

Has anyone an idea?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!