HTML5 Drag and Drop - No transparency?

后端 未结 12 1882
青春惊慌失措
青春惊慌失措 2020-12-05 02:00

When I drag and drop an element on my page the element becomes \"ghosted\". Basically it gets some transparency value.

Is there some way to make it opacity: 1;

12条回答
  •  感情败类
    2020-12-05 02:29

    A working example out of 2012 can be viewed on chrome (you have to use chrome) under "chrome://apps/". If you'd like to know exactly how they did it open the dev tools (strg + shift + i since left click is used for a custom context menu) and start reverse engineering (line 7241 in index.html is a good starting point).

    Here is a quick summery:

    They cloned the dragged element on dragstart, added it into some top-level container and positioned it to the cursor on drag. In order to avoid blocking the events to the actual elements, they styled the clone with pointer-events: none;

提交回复
热议问题