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

228
Views
How to get X,Y coordination after release the Click + Move the mouse at same time - VueJs

I am using Vuedraggable Component which has a Element.

It gets draggable when click + move the mouse across the screen. After releasing the click from the mouse, I want to get a X,Y coordination where we release the mouse move position.

Here is my sample code,

<draggable class="dragArea list-group" :list="list1" @change="log">
    <div
      v-for="element in list1"
      :key="element.name"
      class="list-group-item"
    >
      <button class="button button--line" @change="down" @click="up">
        {{ element.name }}
      </button>
    </div>
  </draggable>

  import draggable from 'vuedraggable';
  
  export default {
       name: 'test',
       data: () => {
            return {
                list1: [{ name: 'Signature Draggable', id: 1 }],
            }
       },
       methods: {
              down(e) {
                    console.log('>>>>>>>>>>>>>>>>1111121');
                    e.target.offsetLeft - e.clientX, e.target.offsetTop - e.clientY;
              },
             up(event) {
                    console.log('###############1111121');
             }
       }

Kindly help me to get the X,Y Coordination.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use the mouse-up event(v-on:mouseup).

<template>
  <div v-on:mousedown="down($event)" v-on:mouseup="up($event)" style="background-color:blue; width:500px;height:500px">
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {}
  },
  methods: {
    up: function (e) {
      console.log('X: ' + e.offsetX + ' Y: ' + e.offsetY)
    },
    down: function (e) {
      console.log('X: ' + e.offsetX + ' Y: ' + e.offsetY)
    }
  }
}
</script>
about 4 years ago · Juan Pablo Isaza 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!