1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <!-- CSS --> <style type="text/css"> .square { width: 100px; height: 100px; border: 1px solid black; margin-bottom: 5px; margin-left: 5px; text-align: center; line-height: 50px; float: left; background-color: lightblue; } .squaredotted { width: 200px; height: 200px; border: 1px dotted gray; margin-bottom: 5px; margin-left: 5px; text-align: center; line-height: 50px; float: left; background-color: lightgray; } </style> <!-- Javascript --> <script> $(function() { $(".square").draggable(); $(".squaredotted").droppable({ drop: function(ev,ui) { $(this).append("<div>Some content</div>"); $("#info").html("dropped!"); }, over: function(event, ui) { $("#info").html("moving in!"); }, out: function(event, ui) { $("#info").html("moving out!"); } }); }); </script> <!-- HTML --> <div></div> <div style="float:left"> <div class="square">Drag me</div> </div> <div style="float:left;margin-left:50px;"> <div class="squaredotted">Drop here</div> <div id="info"></div> </div> |
![wordpress category](https://www.codehaven.co.uk/wp-content/uploads/2018/12/wp12-1.png)