jquery-ui/tests/visual/position/position.html

92 lines
2.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Position Visual Test: Default</title>
<link rel="stylesheet" href="../visual.css" type="text/css" />
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
2012-03-22 13:45:22 +00:00
<script type="text/javascript" src="../../../jquery-1.7.2.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script type="text/javascript">
$(function() {
var inputs = $("input");
$("ul").insertAfter(inputs);
$(window).resize(function() {
inputs.each(function() {
var input = $(this).position({
my: this.id.replace(/-/, " "),
at: this.id.replace(/-/, " "),
of: "#container",
collision: "none"
});
var menu = $(this).next().menu()
menu.position({
my: "left top+20",
at: "left bottom",
of: this,
using: function( position ) {
input.val(position.horizontal + " " + position.vertical)
$(this).offset( position )
.removeClass("left right top bottom")
.addClass(position.horizontal)
.addClass(position.vertical);
}
});
});
}).resize();
});
</script>
<style>
input, .ui-menu { position: absolute; }
.ui-menu { width: 200px; }
html, body { width: 99%; height: 99%; min-height:700px; min-width:700px; }
#container { width: 95%; height: 95%; border: 1px solid black; margin: auto; }
.ui-menu:before {
font-size: 12pt;
content: "↑";
position: absolute;
top: -22px;
left: 5px;
}
.right:before {
left: auto;
right: 5px;
}
.bottom:before {
content: "↓";
top: auto;
bottom: -19px;
}
</style>
</head>
<body>
<div id="container"></div>
<input id="left-top" />
<input id="left-center" />
<input id="left-bottom" />
<input id="center-top" />
<input id="center-center" />
<input id="center-bottom" />
<input id="right-top" />
<input id="right-center" />
<input id="right-bottom" />
<ul>
<li><a href="#">Java</a></li>
<li><a href="#">JavaScript</a></li>
<li><a href="#">Perl</a></li>
<li><a href="#">Ruby</a></li>
<li><a href="#">C++</a></li>
<li><a href="#">Python</a></li>
<li><a href="#">C#</a></li>
</ul>
</body>
</html>