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

118
Views
Prevent default drag in input type range in Vue

Is there any way to prevent the default drag feature of input range, with out impacting the click functionality? The user needs to change the values using clicking but not using drag.

<input   
  type="range"
  min="0"
  max="100"
  step="1"
  class="custom-audio-slider"
/>

demo : https://www.w3schools.com/code/tryit.asp?filename=GVF5ZH6S3HSF

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try like following snippet:

new Vue({
  el: '#demo',
  data() {
    return {
      value: 7,
      drag: false,
      move: false
    }
  },
  methods: {
    dragging() {
      this.drag = true
    },
    stopDragging() {
      this.drag = false
      this.move = false
    },
    moving() {
      if(this.drag) {
        this.move = true
      }
    },
  }
})

Vue.config.productionTip = false
Vue.config.devtools = false
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <span id="valBox"></span>
  <div @mouseover="stopDragging">
    <input type="range" min="0" max="100" step="1" v-model="value" :disabled ="move"
     @mousemove="moving" @mousedown="dragging" @mouseup="stopDragging">
     <p>{{ value }}</p>
   </div>
</div>

over 4 years ago · Santiago Trujillo Report
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!