[英]How to change the drop zone in jQuery
So, I have two problems: 因此,我有两个问题:
Why is this });//]]>
at the top of the page in jsfiddle. 为什么是
});//]]>
在jsfiddle页面顶部。
Second, the real issue, How can I change the drop zone of the jQuery sortable object to reflect where the mouse is. 其次,真正的问题是,如何更改jQuery可排序对象的放置区域以反映鼠标的位置。 So what I mean is, It should not matter where you drag the sortable from (extreme top left corner or bottom right) but instead only rely on if the mouse is over
tab1
or tab2
to be dropped. 因此,我的意思是,从何处拖动排序对象(最左上角或右下角)都没有关系,而仅取决于鼠标是否位于要放置的
tab1
或tab2
上。
Currently, the center of the sortable has to be over tab1
or tab2
. 当前,sortable的中心必须在
tab1
或tab2
。
var $tab_items = $("ul:first li", $tabs).droppable({
accept: ".connectedSortable li",
hoverClass: "ui-state-hover",
drop: function (event, ui) {
var $item = $(this);
var $list = $($item.find("a").attr("href"))
.find(".connectedSortable");
ui.draggable.hide("slow", function () {
$tabs.tabs("select", $tab_items.index($item));
$(this).appendTo($list).show("slow");
});
}
});
I am fairly new to JavaScript and jQuery. 我对JavaScript和jQuery相当陌生。 I think that
drop: function( event, ui ) {
is definitely where i should be looking. 我认为
drop: function( event, ui ) {
绝对是我应该去的地方。 Any insight into this would be greatly appreciated. 任何对此的见解将不胜感激。
http://jsfiddle.net/justinmvail/LARnD/ http://jsfiddle.net/justinmvail/LARnD/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.