这是我的代码,我正在尝试检测jQuery UI .sortable-grid
悬停的元素。我需要获取元素的对象和属性,例如类名(在本例中为.sortable-table
,.sortable-row
,.sortable-cell
,ui.helper
)。
此处的答案仅显示如何获取可拖动项目本身(event.target
或<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0-beta.1/jquery-ui.js"></script>
<div style="background-color:grey;display:inline;cursor:move" id="draggable">DRAG ME</div>
<iframe src="https://fiddle.jshell.net/piglin/UAcC7/1869/show/" id="frame" style="width:100%;overflow:visible" seamless="seamless" scrolling="no"></iframe>
),但不会显示它悬停在上方的元素。
回答的最好方法是使用准备好的JSFiddle,因为我的代码使用iframe,如果在此处发布完整代码,这将无效:
HTML:
$("#draggable").draggable({
drag: function(event, ui) {
//Some code here
}
}
JS:
<?php
class A
{
public $foo = 'bar';
}
class B
{
public function mutateA(A $a)
{
$a->foo = 'qux';
}
}
$a = new A;
echo $a->foo;
$b = new B;
$b->mutateA($a);
echo $a->foo;
// Outputs barqux