English 中文(简体)
jqueryui 大量可减少的问题
原标题:jqueryui draggable droppable issue

我需要一些帮助了解这方面的错误。

当将物品投放到可投放的地区(固定地点)时,它会转移到另一个地方,然后试图将它再拖到适当的地方,就会进一步推进......。

eg: after i drop both apple & banana into droppable area, if I move banana near to apple, it will stick together..

旷日持久的项目曲线离项目本身相距甚远,大概如果我没有确定治疗者的立场,那么在 mo的地方似乎就正确了,这就是我想要挥霍项目,从而 we了......。

as long as item is moved out from droppable area, it need to fly back to draggable and show up neatly at draggable area (item list place). but seems keep on locked / cannot fly back neatly

    <link rel="stylesheet" href="http://jqueryui.com/themes/base/jquery.ui.all.css">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script>

        <style>

    #droppable {
            border:1px solid #000;
            font-weight:bold;
            background-color:#FFF;
            width: 300px;
            height: 400px;
            padding: 0.5em;
            float: left;
            margin: 10px;
        }

    #draggable{
        width:300px;
        float:left;
        border:1px solid #000;
        background-color:#E2EBED;
        padding:3px;
        height:500px;
    }

    .dragableBox{
        border:1px solid #000;
        background-color:#FFF;
        font-weight:bold;
        text-align:center;
        width:150px;
        height:auto;
        margin-bottom:5px;
        padding:3px;
    }

    </style>

        <script type="text/javascript">

    $(function() {

                //draggable setting
        $( ".dragableBox" ).draggable({
                   revert: "invalid",
                   revertDuration: 1000,
                   cursor: "move",
                   delay: 200,
                   opacity: .45,
                   refreshPositions: true,
                   snap: true,
                   containment: "#droppable"
                   //helper: "clone"
                });

                //to allow item at droppable div go back to draggable div neatly.
        $( "#draggable" ).droppable({
                        accept:  .dragableBox ,
            drop: function( event, ui ) {

                          var draggable = ui.draggable;

                                $("#draggable").append(ui.droppable);
            }
        });

                //to append and show it out
        $( "#droppable" ).droppable({

                        accept:  .dragableBox ,

            drop: function( event, ui ) {

                          var draggable = ui.draggable;

                          var html=  Dropped!  +  <br>  +
                               The square with ID "  + draggable.attr( id ) +  " was dropped onto me!  +  <br>  +
                               left: + ui.position.left +   top: + ui.position.top;

              //ajax save actual position to db for later retrieval.

                                $("#droppable").append(ui.draggable);
            }
        });
    });

    </script>




<div class="demo">

<div id="draggable" >
        <div class="dragableBox" id="box1">apple</div>
        <div class="dragableBox" id="box2">banana</div>
        <div class="dragableBox" id="box2">mango</div>
</div>

<div id="droppable" >

</div>

</div>
最佳回答
问题回答

检查这份联合材料:

http://jsfiddle.net/BbSLy/21/

Code:

 $(function() {

    //draggable setting
    $( ".dragableBox" ).draggable({
               revert: "invalid",
               revertDuration: 1000,
               cursor: "move",
               delay: 200,
               opacity: .45,
               refreshPositions: true,
               snap: true,
               containment: "#droppable"
               //helper: "clone"
            });

            //to allow item at droppable div go back to draggable div neatly.
    $( "#droppable" ).droppable({
                    accept:  .dragableBox ,
        drop: function( event, ui ) {

                      var draggable = ui.draggable;

                           // $("#droppable").append(ui.helper.html());
        }
    });

    //to append and show it out
   
});




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

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.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签