拖动可拖动的事件

时间:2012-06-12 12:22:37

标签: jquery

我正在启用自动滚动到特定区域,因为可拖动拖动到特定区域。

当可拖动拖动到不同的可排序时,是否会触发侦听器。在这个小提琴中,当项目被丢弃时,监听器会触发,但是当项目在可放置区域时,是否有一个监听器会触发,但是还没有掉线? http://jsfiddle.net/adrianjsfiddlenetuser/zyUkd/79/

代码:

<div class="connected">
    <div class="myDivs">Hello 01</div>
    <div class="myDivs">Hello 02</div>
    <div class="myDivs excludeThisCss">Hello 03</div>
    <div class="myDivs">Hello 04</div>
    <div class="myDivs">Hello 05</div>
    <div class="myDivs excludeThisCss">Hello 06</div>
    <div class="myDivs">Hello 07</div>
    <div class="myDivs">Hello 08</div>
    <div class="myDivs excludeThisCss">Hello 09</div>
    <div class="myDivs">Hello 10</div>
</div>

<div class="connected">
    <div class="myDivs">Hello 01</div>
    <div class="myDivs">Hello 02</div>
    <div class="myDivs excludeThisCss">Hello 03</div>
    <div class="myDivs">Hello 04</div>
    <div class="myDivs">Hello 05</div>
    <div class="myDivs excludeThisCss">Hello 06</div>
    <div class="myDivs">Hello 07</div>
    <div class="myDivs">Hello 08</div>
    <div class="myDivs excludeThisCss">Hello 09</div>
    <div class="myDivs">Hello 10</div>
</div>

​.connected {
    float: left;
    margin: 6px;
}
.myDivs {
    margin: 0 5px 5px 5px;
    padding: 5px;
    font-size: 1.2em;
    font-family: sans-serif;
    width: 120px;
    background: #F2F2F2;
    cursor: pointer;
    border: 1px solid #D9D9D9;
    color: #1C94C4;
}
.excludeThisCss {
    background: pink;
}
​$(function() {
    $( ".connected" ).sortable({
        connectWith : ".connected",
        items       : ".myDivs:not(.excludeThisCss)",
        stop        : function(event,ui) { alert($(ui.item).text()) }
    }).disableSelection();

});​

0 个答案:

没有答案