How to make a polymer element draggable

↘锁芯ラ 提交于 2019-12-03 12:09:47

I know this is fairly dated, but I'm leaving this here for others who might be looking. There is a core element in Polymer now for dragging support: https://github.com/Polymer/core-drag-drop. There is a demo.html file to show you how to use it.

For Polymer 1.0/2.0

Most answers here tackle try to answer the OP for Polymer v0.5 [outdated]. Core prefixed elements will not work for Polymer 1.0 or 2.0.

Refer to sortablejs, which supports polymer based drag and drop.

to make my Polymer elements draggable I used the JS library Draggabilly, in my case the polymer components were also in a grid, so i used it in combination with Packery

Polymer Gesture Events can be used to make a polymer component draggable.

  1. Inherit Polymer.GestureEventListeners
  2. Add track event listener:

<div id="dragme" on-track="handleTrack"></div>

A detailed sample is already provided on Polymer Gesture Events page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!