How do I highlight a droppable area on hover using jquery ui draggable

前端 未结 3 1787
我寻月下人不归
我寻月下人不归 2020-12-29 19:43

I actually have two questions, the on in the title being the main one. I have multiple div elements on the page marked as droppable. Inside these div elements I have spans

3条回答
  •  清酒与你
    2020-12-29 20:38

    Check out http://jqueryui.com/demos/droppable/#visual-feedback.

    Ex:

    $( "#draggable" ).draggable();
    $( "#droppable" ).droppable({
        hoverClass: "ui-state-active",
        drop: function( event, ui ) {
            $( this )
                .addClass( "ui-state-highlight" )
                .find( "p" )
                    .html( "Dropped!" );
        }
    });
    $( "#draggable2" ).draggable();
    $( "#droppable2" ).droppable({
        accept: "#draggable2",
        activeClass: "ui-state-hover",
        drop: function( event, ui ) {
            $( this )
                .addClass( "ui-state-highlight" )
                .find( "p" )
                    .html( "Dropped!" );
        }
    });
    

提交回复
热议问题