English 中文(简体)
j Query Drag plugin - 防止在另一辆汽车顶上丢一个 d子。
原标题:jQuery Drag plugin - Prevent dropping of a drag element on the top of another

I use the j Query pluins .event.drag and

http:// threedubmedia.com/code/event/drag/demo/contain”rel=“nofollow noreferer”>demo。 (一个参照问题不是限制集装箱的移动)

Is it possible to prevent dropping of a drag element on the top of another element? but it can be dragged over the other.

问题回答

虽然你可以完成你对这次活动的期望。 drag/drop script it is also accessible using jquery ui - draggable/droppable.

如果符合你的标准(或相反):

$( #drag1 ).drop("init",function(){
            if ( $( this ).is( #badDiv ) ) 
                return false;
        })

这里是“jquery ui”版本,它有一个建筑,接受(......)可逆功能中的选择——它还接受选择。 以上例子相反。 以上将允许你在任何地方行动,但不要错失。

文字:

$("#drag1, #drag2").draggable({
          revert:    invalid 
 });
$("#drop").droppable({
    accept:  #drag1 ,
    drop: function(event, ui) {
          // whatever happens on drop
    }
});

html:

<div id="drop" style="width:300px;height:300px;background:blue"></div>
<div id="drag1" style="width:50px;height:50px;background:green"></div>
<div id="drag2" style="width:50px;height:50px;background:yellow"></div>

这造成了一片大面积可 drop的面积,但只能接受可观的 d1。 看到这种结果,你也需要选择重任。 我将此案件定为无效,这样,如果退款无效,则该可逃到原岗位。

我不敢肯定你的确切应用,但也许这将给你指明你重新努力完成的工作的方向。

我认为,这种表格使用类似的套件,但更多的是配电机和调整表。

你们可以以这种方式指派一名有效的退款目标选择人。

$( .drag ).drag(function( event, dd ){
     // move the dragged element
},{ drop: #drop1  }); // assign drop selector 

你们还可以遣返一些“false”的退学事件处理者。

$( .drop ).bind( dropinit drop ,function( event, dd ){
    if ( $( dd.drag ).is( #drag1 ) )
        return false;
});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签