Vue.draggable: Specify draggable area

Created on 24 Feb 2020  路  4Comments  路  Source: SortableJS/Vue.Draggable

is there any way to restrict like the dragging area?

Most helpful comment

@JelleScheer nope, this don't work:

<draggable v-model="contentItems" draggable=".drag-starter">
  <div v-for="contentItem in contentItems" class="item">
    <i class="some-icon drag-starter">aaa</i>
    {{ contentItem.headline }}
  </div>
</draggable>

it works when I use handle instead of draggable see: https://github.com/SortableJS/Vue.Draggable/blob/master/example/components/handle.vue

This works thanks, handle does the trick

All 4 comments

What do you mean?

Right now the draggable item (draggable=".item") should be a direct child of the wrapper, but there are cases where you don't want the entire child to trigger the drag but for example let an icon inside the item initiate the dragging, like so:

<draggable draggable=".drag-starter">
   <div class="item">
      <i class="some-icon drag-starter"></i>
   </div>
</draggable>

@JelleScheer nope, this don't work:

<draggable v-model="contentItems" draggable=".drag-starter">
  <div v-for="contentItem in contentItems" class="item">
    <i class="some-icon drag-starter">aaa</i>
    {{ contentItem.headline }}
  </div>
</draggable>

it works when I use handle instead of draggable see: https://github.com/SortableJS/Vue.Draggable/blob/master/example/components/handle.vue

@JelleScheer nope, this don't work:

<draggable v-model="contentItems" draggable=".drag-starter">
  <div v-for="contentItem in contentItems" class="item">
    <i class="some-icon drag-starter">aaa</i>
    {{ contentItem.headline }}
  </div>
</draggable>

it works when I use handle instead of draggable see: https://github.com/SortableJS/Vue.Draggable/blob/master/example/components/handle.vue

This works thanks, handle does the trick

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leadaxe picture Leadaxe  路  3Comments

ghost picture ghost  路  3Comments

Stetzon picture Stetzon  路  3Comments

mathlet0x picture mathlet0x  路  4Comments

rootman picture rootman  路  3Comments