jquery-ui/demos/position/default.html

80 lines
1.7 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Position - Default functionality</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.draggable.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
body {
margin: 0;
padding: 0;
}
body > div[style*='display'] {
/* Workaround */
/* position: absolute; */
}
.blue {
background: blue;
float: left;
width: 100px;
}
.red {
background: red;
float: left;
overflow-y: hidden;
}
.content {
width: 2000px;
height: 400px;
border: 2px solid white;
}
#uiPosition {
width: 100px;
height: 100px;
background: #ccc;
}
</style>
<script>
$(function() {
$( "#redBlock" ).css({
width: $( window ).width() - $( "#blueBlock" ).width()
});
$( ".block" ).css({
height: $( window ).height()
});
$( "button" ).on('click', function (e) {
$( "#uiPosition" )
.position({
my: "left top",
at: "left bottom",
of: e.target,
within: $( "#redBlock" ),
collision: "flip"
});
});
});
</script>
</head>
<body>
<div class="block blue" id="blueBlock"></div>
<div class="block red" id="redBlock">
<div class="content">
<button>Position</button>
</div>
</div>
<div id="uiPosition"></div>
</body>
</html>