2012-04-15 18:25:55 +00:00
|
|
|
<!doctype html>
|
2009-07-24 18:24:13 +00:00
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2010-09-10 14:24:33 +00:00
|
|
|
<meta charset="utf-8">
|
2009-07-24 18:24:13 +00:00
|
|
|
<title>jQuery UI Position - Default functionality</title>
|
2013-12-02 18:36:12 +00:00
|
|
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
2010-09-10 14:24:33 +00:00
|
|
|
<link rel="stylesheet" href="../demos.css">
|
|
|
|
<style>
|
2013-05-16 12:32:58 +00:00
|
|
|
#parent {
|
|
|
|
width: 60%;
|
|
|
|
height: 40px;
|
|
|
|
margin: 10px auto;
|
|
|
|
padding: 5px;
|
|
|
|
border: 1px solid #777;
|
|
|
|
background-color: #fbca93;
|
|
|
|
text-align: center;
|
2010-03-17 19:22:05 +00:00
|
|
|
}
|
2013-05-16 12:32:58 +00:00
|
|
|
.positionable {
|
|
|
|
position: absolute;
|
|
|
|
display: block;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
background-color: #bcd5e6;
|
|
|
|
text-align: center;
|
2010-03-17 19:22:05 +00:00
|
|
|
}
|
2013-05-16 12:32:58 +00:00
|
|
|
#positionable1 {
|
|
|
|
width: 75px;
|
|
|
|
height: 75px;
|
2011-09-16 15:33:26 +00:00
|
|
|
}
|
2013-05-16 12:32:58 +00:00
|
|
|
#positionable2 {
|
|
|
|
width: 120px;
|
|
|
|
height: 40px;
|
2011-09-16 15:33:26 +00:00
|
|
|
}
|
2013-05-16 12:32:58 +00:00
|
|
|
select, input {
|
|
|
|
margin-left: 15px;
|
2010-03-17 19:22:05 +00:00
|
|
|
}
|
|
|
|
</style>
|
2015-06-30 23:01:59 +00:00
|
|
|
<script src="../../external/requirejs/require.js"></script>
|
|
|
|
<script src="../bootstrap.js" data-modules="draggable">
|
2013-05-16 12:32:58 +00:00
|
|
|
function position() {
|
|
|
|
$( ".positionable" ).position({
|
|
|
|
of: $( "#parent" ),
|
|
|
|
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
|
|
|
|
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
|
|
|
|
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
|
|
|
|
});
|
|
|
|
}
|
2010-09-10 14:24:33 +00:00
|
|
|
|
2013-05-16 12:32:58 +00:00
|
|
|
$( ".positionable" ).css( "opacity", 0.5 );
|
|
|
|
|
2015-05-14 02:05:07 +00:00
|
|
|
$( "select, input" ).on( "click keyup change", position );
|
2013-05-16 12:32:58 +00:00
|
|
|
|
|
|
|
$( "#parent" ).draggable({
|
|
|
|
drag: position
|
2013-05-16 10:26:03 +00:00
|
|
|
});
|
2013-05-16 12:32:58 +00:00
|
|
|
|
|
|
|
position();
|
2009-07-24 18:24:13 +00:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
2013-05-16 12:32:58 +00:00
|
|
|
<div id="parent">
|
|
|
|
<p>
|
|
|
|
This is the position parent element.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="positionable" id="positionable1">
|
|
|
|
<p>
|
|
|
|
to position
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="positionable" id="positionable2">
|
|
|
|
<p>
|
|
|
|
to position 2
|
|
|
|
</p>
|
|
|
|
</div>
|
2009-07-24 18:24:13 +00:00
|
|
|
|
2013-05-16 12:32:58 +00:00
|
|
|
<div style="padding: 20px; margin-top: 75px;">
|
|
|
|
position...
|
|
|
|
<div style="padding-bottom: 20px;">
|
|
|
|
<b>my:</b>
|
|
|
|
<select id="my_horizontal">
|
|
|
|
<option value="left">left</option>
|
|
|
|
<option value="center">center</option>
|
|
|
|
<option value="right">right</option>
|
|
|
|
</select>
|
|
|
|
<select id="my_vertical">
|
|
|
|
<option value="top">top</option>
|
|
|
|
<option value="center">center</option>
|
|
|
|
<option value="bottom">bottom</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div style="padding-bottom: 20px;">
|
|
|
|
<b>at:</b>
|
|
|
|
<select id="at_horizontal">
|
|
|
|
<option value="left">left</option>
|
|
|
|
<option value="center">center</option>
|
|
|
|
<option value="right">right</option>
|
|
|
|
</select>
|
|
|
|
<select id="at_vertical">
|
|
|
|
<option value="top">top</option>
|
|
|
|
<option value="center">center</option>
|
|
|
|
<option value="bottom">bottom</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div style="padding-bottom: 20px;">
|
|
|
|
<b>collision:</b>
|
|
|
|
<select id="collision_horizontal">
|
|
|
|
<option value="flip">flip</option>
|
|
|
|
<option value="fit">fit</option>
|
|
|
|
<option value="flipfit">flipfit</option>
|
|
|
|
<option value="none">none</option>
|
|
|
|
</select>
|
|
|
|
<select id="collision_vertical">
|
|
|
|
<option value="flip">flip</option>
|
|
|
|
<option value="fit">fit</option>
|
|
|
|
<option value="flipfit">flipfit</option>
|
|
|
|
<option value="none">none</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2013-05-16 10:26:03 +00:00
|
|
|
|
2013-05-16 12:32:58 +00:00
|
|
|
<div class="demo-description">
|
|
|
|
<p>Use the form controls to configure the positioning, or drag the positioned element to modify its offset.
|
|
|
|
<br>Drag around the parent element to see collision detection in action.</p>
|
|
|
|
</div>
|
2009-07-24 18:24:13 +00:00
|
|
|
</body>
|
|
|
|
</html>
|