jquery-ui/tests/visual/menu/menu.html
TJ VanToll de2ef2a585 Menu: Wrap menu items in a <div>
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes gh-1342
2014-10-25 10:10:30 -07:00

350 lines
8.6 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Menu Visual Test: Default</title>
<link rel="stylesheet" href="../../../themes/base/all.css">
<script src="../../../external/jquery/jquery.js"></script>
<script src="../../../ui/core.js"></script>
<script src="../../../ui/widget.js"></script>
<script src="../../../ui/position.js"></script>
<script src="../../../ui/menu.js"></script>
<script>
$(function() {
function logger( event, ui ) {
$( "<p>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
}
$( "#menu1, #menu3, .menu4" ).menu({
select: logger
});
$( "#menu2" ).menu({
position: {
my: "left top",
at: "left+10 top-20"
},
select: logger
});
$( "#menu5" ).menu({
menus: ".menuElement",
select: logger
});
$( "#menu6" ).menu({
menus: ".menuElement",
select: logger,
icon: "ui-icon-carat-1-s"
});
$( "#menu7" ).menu({
items: "> :not('.ui-menu-group')",
select: logger
});
});
</script>
<style>
.ui-menu { width: 250px; margin-bottom: 2em; }
.menu4 { height: 225px; overflow-y: auto; overflow-x: hidden; }
.address-item { border-bottom: 1px solid #999; }
.address-header { display: block; margin-bottom: .2em; font-weight: bold; }
.address-content { display: block; margin-bottom: .2em; padding-left: 10px; }
</style>
</head>
<body>
<h2>Default inline menu</h2>
<ul id="menu1">
<li><div>Aberdeen</div></li>
<li><div>Ada</div></li>
<li><div>Adamsville</div></li>
<li><div>Addyston</div></li>
<li><div>Delphi</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
<h2>Inline with disabled items and submenus</h2>
<ul id="menu2">
<li class="ui-state-disabled"><div>Aberdeen</div></li>
<li><div>Ada</div></li>
<li><div>Adamsville</div></li>
<li><div>Addyston</div></li>
<li>
<div>Delphi</div>
<ul>
<li class="ui-state-disabled"><div>Ada</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li><div>Saarland</div></li>
<li>
<div>Salzburg</div>
<ul>
<li>
<div>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li>
<div>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li class="ui-state-disabled"><div>Perch</div></li>
</ul>
</li>
<li class="ui-state-disabled"><div>Amesville</div></li>
</ul>
<h2>Menu with icons</h2>
<ul id="menu3">
<li>
<div><span class="ui-icon ui-icon-print"></span>Aberdeen</div>
</li>
<li class="ui-state-disabled">
<div><span class="ui-icon ui-icon-scissors"></span>Ada</div>
</li>
<li><div>Adamsville</div></li>
<li>
<div><span class="ui-icon ui-icon-wrench"></span>Addyston</div>
</li>
<li class="ui-state-disabled">
<div>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li>
<div><span class="ui-icon ui-icon-wrench"></span>Saarland</div>
</li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li>
<div>Saarland</div></li>
<li>
<div>
<span class="ui-icon ui-icon-print"></span>Salzburg
</div>
<ul>
<li>
<div><span class="ui-icon ui-icon-wrench"></span>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li>
<div>Delphi</div>
<ul>
<li><div><span class="ui-icon ui-icon-wrench"></span>Ada</div></li>
<li><div><span class="ui-icon ui-icon-wrench"></span>Saarland</div></li>
<li><div><span class="ui-icon ui-icon-wrench"></span>Salzburg</div></li>
</ul>
</li>
<li><div>Perch</div></li>
</ul>
</li>
</ul>
<h2>Long menu with scroll overflow, to test menu's scroll-on-keypress behaviour</h2>
<ul class="menu4">
<li><div>Aberdeen</div></li>
<li><div>Ada</div></li>
<li><div>Adamsville</div></li>
<li><div>Addyston</div></li>
<li><div>Adelphi</div></li>
<li><div>Adena</div></li>
<li><div>Adrian</div></li>
<li><div>Akron</div></li>
<li><div>Albany</div></li>
<li><div>Alexandria</div></li>
<li><div>Alger</div></li>
<li><div>Alledonia</div></li>
<li><div>Alliance</div></li>
<li><div>Alpha</div></li>
<li><div>Alvada</div></li>
<li><div>Alvordton</div></li>
<li><div>Amanda</div></li>
<li><div>Amelia</div></li>
<li><div>Amesville</div></li>
<li><div>Aberdeen</div></li>
<li><div>Ada</div></li>
<li><div>Adamsville</div></li>
<li><div>Addyston</div></li>
<li><div>Adelphi</div></li>
<li><div>Adena</div></li>
<li><div>Adrian</div></li>
<li><div>Akron</div></li>
<li><div>Albany</div></li>
<li><div>Alexandria</div></li>
<li><div>Alger</div></li>
<li><div>Alledonia</div></li>
<li><div>Alliance</div></li>
<li><div>Alpha</div></li>
<li><div>Alvada</div></li>
<li><div>Alvordton</div></li>
<li><div>Amanda</div></li>
<li><div>Amelia</div></li>
<li><div>Amesville</div></li>
</ul>
<h2>Menu with custom markup</h2>
<div id="menu5" class="menuElement">
<blockquote><div>Aberdeen</div></blockquote>
<blockquote><div>Ada</div></blockquote>
<blockquote class="ui-state-disabled"><div>Adamsville</div></blockquote>
<blockquote><div>Addyston</div></blockquote>
<blockquote>
<div>Delphi</div>
<blockquote class="menuElement">
<blockquote><div>Ada</div></blockquote>
<blockquote><div>Saarland</div></blockquote>
<blockquote><div>Salzburg</div></blockquote>
</blockquote>
</blockquote>
<blockquote><div>Saarland</div></blockquote>
<blockquote>
<div>Salzburg</div>
<blockquote class="menuElement">
<blockquote>
<div>Delphi</div>
<blockquote class="menuElement">
<blockquote><div>Ada</div></blockquote>
<blockquote><div>Saarland</div></blockquote>
<blockquote><div>Salzburg</div></blockquote>
</blockquote>
</blockquote>
<blockquote>
<div>Delphi</div>
<blockquote class="menuElement">
<blockquote><div>Ada</div></blockquote>
<blockquote><div>Saarland</div></blockquote>
<blockquote><div>Salzburg</div></blockquote>
</blockquote>
</blockquote>
<blockquote><div>Perch</div></blockquote>
</blockquote>
</blockquote>
</div>
<h2>Menu with custom markup, multi-line items and a custom submenu icon</h2>
<div class="menuElement" id="menu6">
<div class="address-item">
<div>
<span class="address-header">John Doe</span>
<span class="address-content">78 West Main St Apt 3A</span>
<span class="address-content">Bloomsburg, PA 12345</span>
</div>
</div>
<div class="address-item">
<div>
<span class="address-header">Jane Doe</span>
<span class="address-content">78 West Main St Apt 3A</span>
<span class="address-content">Bloomsburg, PA 12345</span>
</div>
</div>
<div class="address-item ui-state-disabled">
<div>
<span class="address-header">James Doe</span>
<span class="address-content">78 West Main St Apt 3A</span>
<span class="address-content">Bloomsburg, PA 12345</span>
</div>
</div>
<div class="address-item">
<div>
<span class="address-header">Jenny Doe</span>
<span class="address-content">78 West Main St Apt 3A</span>
<span class="address-content">Bloomsburg, PA 12345</span>
</div>
</div>
<div class="address-item">
<div>
<span class="address-header">John Doe</span>
<span class="address-content">78 West Main St Apt 3A</span>
<span class="address-content">Bloomsburg, PA 12345</span>
</div>
<div class="menuElement">
<div>
<div>Ada</div>
</div>
<div>
<div>Saarland</div>
</div>
<div>
<div>Salzburg</div>
</div>
</div>
</div>
</div>
<h2>Inline with dividers and group labels</h2>
<ul id="menu7">
<li class="ui-menu-group">
<div><strong>Group 1</strong></div>
</li>
<li><div>Aberdeen</div></li>
<li><div>Ada</div></li>
<li><div>Adamsville</div></li>
<li><div>Addyston</div></li>
<li></li>
<li class="ui-menu-group">
<div><strong>Group 2</strong></div>
</li>
<li>
<div>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li><div>Saarland</div></li>
<li>---</li>
<li class="ui-menu-group">
<div><strong>Group 3</strong></div>
</li>
<li>
<div>Salzburg</div>
<ul>
<li>
<div>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li>-</li>
<li><div>Saarland</div></li>
<li>&mdash;</li>
<li><div>Salzburg</div></li>
<li>&ndash;</li>
</ul>
</li>
<li>
<div>Delphi</div>
<ul>
<li><div>Ada</div></li>
<li><div>Saarland</div></li>
<li><div>Salzburg</div></li>
</ul>
</li>
<li><div>Perch</div></li>
</ul>
</li>
<li><div>Amesville</div></li>
</ul>
<div style="position: absolute; top: 1em; right: 1em;">
Log:
<div id="log" style="height: 400px; width: 300px; overflow: auto; border: 1px solid #000;"></div>
</div>
</body>
</html>