如何在Safari HTML5中对表行启用重影效果? [英] How to enable the ghost effect on a table row in Safari HTML5?
问题描述
当我在Safari上拖动项目(表
行)时,没有鬼影效果。
我使用表
,所以这是 tr
。幻影效果是当您看到跟随鼠标的项目时。
I don't have the ghost effect when I drag item (table
row) on Safari.
I use table
so this is a tr
. The ghost effect is when you can see your item which follow your mouse.
在Chrome上可以运行FF。
On Chrome, FF it works.
有人知道为什么吗?
我注意到它不仅在 tr / td
上。如果使用 li
或 a
,我可以看到幻影效果...
I noticed it doesn't only on tr/td
. If I use li
or a
, I can see the ghost effect...
Chrome
Safari
推荐答案
在OSX Safari上,只要将与拖放相关的事件侦听器附加到表行,就会显示拖动帮助器(重影效果)。
On OSX Safari the drag helper (ghost effect) shows up as soon as you attach drag&drop related event listeners to the table rows.
<table>
<tr id="row1" draggable="true">
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr id="row2">
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table>
只有这样,拖动帮助器才会显示。
With only this, drag helper won't show up.
但是一旦您附加了一个事件,它就会:
But as soon as you attach an event, it will:
var row1 = document.getElementById('row1');
row1.addEventListener('dragstart', function(e) {
//Dragstart code here
}, false);
希望这会有所帮助。
这篇关于如何在Safari HTML5中对表行启用重影效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!