over 8 years ago
The Droppable function can be used in JqueryUI to enable dropable functionality on a DOM element. In the example below using drop-able function we can drag an element and drop it to another container.
Example code:
<!doctype html> <html lang="en"> <head> <title>jQuery UI Droppable </title> <style> #draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; } </style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script> <script> $( function() { $( "#draggable" ).draggable(); $( "#droppable" ).droppable({ drop: function( event, ui ) { $( this ) .find( "p" ) .html( "Dropped!" ) $( "#droppable" ).css( "background-color", "green"); $( "#draggable" ).html( ""); } }); } ); </script> </head> <body> <div id="draggable" style="background-color: #03a9f4;"> <p>Drag me </p> </div> <div id="droppable"style="background-color: #ececec;"> <p>Drop here</p> </div> </body> </html>
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)