mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Update menubar to forward menu option to nested menus, update default demo to set within update to the demo frame (for /demos) or window (standalone). Update visual test to have more useful defaults
This commit is contained in:
parent
433ed6eecf
commit
7281f9f229
@ -13,9 +13,10 @@
|
|||||||
<script src="../../ui/jquery.ui.menubar.js"></script>
|
<script src="../../ui/jquery.ui.menubar.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
|
$("#bar1").menubar({
|
||||||
|
position: {
|
||||||
$("#bar1, .menubar").menubar({
|
within: $("#demo-frame").add(window).first()
|
||||||
|
},
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
|
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
|
||||||
}
|
}
|
||||||
@ -24,6 +25,9 @@
|
|||||||
$(".menubar-icons").menubar({
|
$(".menubar-icons").menubar({
|
||||||
menuIcon: true,
|
menuIcon: true,
|
||||||
buttons: true,
|
buttons: true,
|
||||||
|
position: {
|
||||||
|
within: $("#demo-frame").add(window).first()
|
||||||
|
},
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
|
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
|
||||||
}
|
}
|
||||||
@ -160,63 +164,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--
|
|
||||||
<table id="movies" class="ui-widget">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-field="Name" class="ui-widget-header">Name</th>
|
|
||||||
<th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
|
|
||||||
<th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
|
|
||||||
<th class="ui-widget-header"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
|
|
||||||
<td class="ui-widget-content">1993</td>
|
|
||||||
<td class="ui-widget-content">3.6</td>
|
|
||||||
<td class="ui-widget-content">
|
|
||||||
<ul class="menubar">
|
|
||||||
<li>
|
|
||||||
<a href="#Options">Options</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#Order...">Order...</a></li>
|
|
||||||
<li class="ui-state-disabled">Write a Review...</li>
|
|
||||||
<li><a href="#Find Similar Movies...">Find Similar Movies...</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="#Rate">Rate</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#5 stars">5 stars</a></li>
|
|
||||||
<li><a href="#4 stars">4 stars</a></li>
|
|
||||||
<li><a href="#3 stars">3 stars</a></li>
|
|
||||||
<li><a href="#2 stars">2 stars</a></li>
|
|
||||||
<li><a href="#1 stars">1 stars</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
|
|
||||||
<td class="ui-widget-content">1991</td>
|
|
||||||
<td class="ui-widget-content">3.1</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
|
|
||||||
<td class="ui-widget-content">1991</td>
|
|
||||||
<td class="ui-widget-content">3.9</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="ui-widget-content">Spike and Mike's Sick & Twisted Festival of Animation</td>
|
|
||||||
<td class="ui-widget-content">1997</td>
|
|
||||||
<td class="ui-widget-content">2.6</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
|
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
|
||||||
Log:
|
Log:
|
||||||
<div id="log" style="height: 100px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
|
<div id="log" style="height: 100px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
<select id="my_horizontal">
|
<select id="my_horizontal">
|
||||||
<option value="left">left</option>
|
<option value="left">left</option>
|
||||||
<option value="center">center</option>
|
<option value="center">center</option>
|
||||||
<option value="right">right</option>
|
<option value="right" selected="selected">right</option>
|
||||||
</select>
|
</select>
|
||||||
<select id="my_vertical">
|
<select id="my_vertical">
|
||||||
<option value="top">top</option>
|
<option value="top">top</option>
|
||||||
@ -155,7 +155,7 @@
|
|||||||
<select id="at_horizontal">
|
<select id="at_horizontal">
|
||||||
<option value="left">left</option>
|
<option value="left">left</option>
|
||||||
<option value="center">center</option>
|
<option value="center">center</option>
|
||||||
<option value="right">right</option>
|
<option value="right" selected="selected">right</option>
|
||||||
</select>
|
</select>
|
||||||
<select id="at_vertical">
|
<select id="at_vertical">
|
||||||
<option value="top">top</option>
|
<option value="top">top</option>
|
||||||
|
15
ui/jquery.ui.menubar.js
vendored
15
ui/jquery.ui.menubar.js
vendored
@ -21,7 +21,11 @@ $.widget( "ui.menubar", {
|
|||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
options: {
|
options: {
|
||||||
buttons: false,
|
buttons: false,
|
||||||
menuIcon: false
|
menuIcon: false,
|
||||||
|
position: {
|
||||||
|
my: "left top",
|
||||||
|
at: "left bottom"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_create: function() {
|
_create: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
@ -39,6 +43,9 @@ $.widget( "ui.menubar", {
|
|||||||
this._hoverable( items );
|
this._hoverable( items );
|
||||||
items.next( "ul" )
|
items.next( "ul" )
|
||||||
.menu({
|
.menu({
|
||||||
|
position: {
|
||||||
|
within: this.options.position.within
|
||||||
|
},
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
ui.item.parents( "ul.ui-menu:last" ).hide();
|
ui.item.parents( "ul.ui-menu:last" ).hide();
|
||||||
that._trigger( "select", event, ui );
|
that._trigger( "select", event, ui );
|
||||||
@ -210,11 +217,9 @@ $.widget( "ui.menubar", {
|
|||||||
var button = menu.prev().addClass( "ui-state-active" ).attr( "tabIndex", -1 );
|
var button = menu.prev().addClass( "ui-state-active" ).attr( "tabIndex", -1 );
|
||||||
this.active = menu
|
this.active = menu
|
||||||
.show()
|
.show()
|
||||||
.position( {
|
.position( $.extend({
|
||||||
my: "left top",
|
|
||||||
at: "left bottom",
|
|
||||||
of: button
|
of: button
|
||||||
})
|
}, this.options.position ) )
|
||||||
.removeAttr( "aria-hidden" )
|
.removeAttr( "aria-hidden" )
|
||||||
.attr( "aria-expanded", "true" )
|
.attr( "aria-expanded", "true" )
|
||||||
.menu("focus", event, menu.children( "li" ).first() )
|
.menu("focus", event, menu.children( "li" ).first() )
|
||||||
|
Loading…
Reference in New Issue
Block a user