0

当可拖动对象被拖动到特定区域时,我正在启用自动滚动到特定区域。

当一个可拖动对象被拖动到不同的可排序对象上时,是否有一个监听器会触发。在这个小提琴中,当项目被丢弃时监听器会触发,但是当项目在可放置区域但尚未被丢弃时是否有监听器触发? 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();

});​
4

0 回答 0