jquery-ui/demos/droppable/greedy.html

73 lines
2.0 KiB
HTML
Raw Normal View History

2008-12-30 15:51:51 +00:00
<!doctype html>
<html lang="en">
<head>
2008-12-31 22:16:02 +00:00
<title>jQuery UI Droppable - Greedy Demo</title>
2008-12-30 15:51:51 +00:00
<link type="text/css" href="../../themes/default/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../../ui/ui.droppable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
2008-12-30 15:51:51 +00:00
<style type="text/css">
2009-01-01 00:27:45 +00:00
#draggable { width: 100px; height: 40px; padding: 0.5em; float: left; margin: 10px; }
#droppable, #droppable2 { width: 230px; height: 120px; padding: 0.5em; float: left; margin: 10px; }
#droppable-inner, #droppable2-inner { width: 170px; height: 60px; padding: 0.5em; float: left; margin: 10px; }
2008-12-30 15:51:51 +00:00
</style>
<script type="text/javascript">
$(function() {
2008-12-30 15:51:51 +00:00
$("#draggable").draggable();
2008-12-30 15:51:51 +00:00
$("#droppable, #droppable-inner").droppable({
activeClass: 'ui-state-hover',
hoverClass: 'ui-state-active',
drop: function(event, ui) {
$(this).addClass('ui-state-highlight').find('p').html('Dropped!');
}
});
2008-12-30 15:51:51 +00:00
$("#droppable2, #droppable2-inner").droppable({
greedy: true,
activeClass: 'ui-state-hover',
hoverClass: 'ui-state-active',
drop: function(event, ui) {
$(this).addClass('ui-state-highlight').find('p').html('Dropped!');
}
});
2008-12-30 15:51:51 +00:00
});
</script>
</head>
<body>
<div class="demo">
2008-12-30 15:51:51 +00:00
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header">
2009-01-01 00:27:45 +00:00
<p>Outer droppable</p>
2008-12-30 15:51:51 +00:00
<div id="droppable-inner" class="ui-widget-header">
2009-01-01 00:27:45 +00:00
<p>Inner droppable (not greedy)</p>
2008-12-30 15:51:51 +00:00
</div>
</div>
<div id="droppable2" class="ui-widget-header">
2009-01-01 00:27:45 +00:00
<p>Outer droppable</p>
2008-12-30 15:51:51 +00:00
<div id="droppable2-inner" class="ui-widget-header">
2009-01-01 00:27:45 +00:00
<p>Inner droppable (greedy)</p>
2008-12-30 15:51:51 +00:00
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>
<!-- Add description here -->
</p>
</div><!-- End demo-description -->
2008-12-30 15:51:51 +00:00
</body>
</html>