html - JQuery: Dragged item is getting hidden after drop into another item with resizable option -
i have 2 div tags, 1 draggable , other droppable. drag , drop working fine. if override resizable method droppable element, dragged item getting hidden. should appear on top of target item. have included complete code. please me. in advance.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui resizable - synchronous resize</title> <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> <script src="../../jquery-1.9.1.js"></script> <script src="../../ui/jquery.ui.core.js"></script> <script src="../../ui/jquery.ui.widget.js"></script> <script src="../../ui/jquery.ui.mouse.js"></script> <script src="../../ui/jquery.ui.resizable.js"></script> <script src="../../ui/jquery.ui.draggable.js"></script> <script src="../../ui/jquery.ui.droppable.js"></script> <link rel="stylesheet" href="../demos.css"> <style> #draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } #droptarget1 { width: 150px; height: 150px; padding: 0.5em; margin: 10px; } #droptarget2a { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 0px; } #droptarget2b { width: 150px; height: 150px; padding: 0.5em; margin: 0px; } </style> <script> $(function() { $( "#draggable" ).draggable(); //droppable events $( "#droptarget1" ).droppable({ drop: function( event, ui ) { $( ) .find( "p" ) .html( "dropped @ target 1!" ); } }); $( "#droptarget2a" ).droppable({ drop: function( event, ui ) { $( ) .find( "p" ) .html( "dropped @ target 2a!" ); } }); $( "#droptarget2b" ).droppable({ drop: function( event, ui ) { $( ) .find( "p" ) .html( "dropped @ target 2b!" ); } }); //resizable events $( "#droptarget2a" ).resizable( { resize: function(event, ui){ $("#droptarget2b").css("height", ui.size.height+"px"); } }); $( "#droptarget2b" ).resizable( { resize: function(event, ui){ $("#droptarget2a").css("height", ui.size.height+"px"); } }); }); </script> </head> <body> <div id="draggable" class="ui-widget-content"><p>drag me target</p></div> <div id="droptarget1" class="ui-widget-content"><p>target 1</p></div> <div id="droptarget2a" class="ui-widget-content"><p>target 2a</p></div> <div id="droptarget2b" class="ui-widget-content"><p>target 2b</p></div> </body> </html>
i think including z-index property in css work. draggable set higher z-index droppable draggable visible on droppable. add following code css:
#draggable { z-index:1 } #droptarget1 { z-index:0 } #droptarget2a { z-index:0 } #droptarget2b { z-index:0 }
here working jsfiddle
Comments
Post a Comment