mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Popup: Rename _close to close and use it when selecting something within a popup.
This commit is contained in:
parent
bba4cb2be6
commit
b96126b398
@ -24,8 +24,12 @@
|
|||||||
});
|
});
|
||||||
$(".set").buttonset();
|
$(".set").buttonset();
|
||||||
|
|
||||||
// TODO hide the tooltip when clicking the button
|
$("ul").menu({
|
||||||
$("ul").menu().popup({
|
select: function() {
|
||||||
|
// would also execute some other action here
|
||||||
|
$(this).popup("close");
|
||||||
|
}
|
||||||
|
}).popup({
|
||||||
trigger: $(".menu")
|
trigger: $(".menu")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
var selected = {
|
var selected = {
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
$( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
|
$( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
|
||||||
$(this).hide();
|
$(this).popup("close");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ $.widget( "ui.popup", {
|
|||||||
|
|
||||||
this.element
|
this.element
|
||||||
.addClass("ui-popup")
|
.addClass("ui-popup")
|
||||||
this._close();
|
this.close();
|
||||||
|
|
||||||
this._bind(this.options.trigger, {
|
this._bind(this.options.trigger, {
|
||||||
click: function( event ) {
|
click: function( event ) {
|
||||||
@ -53,7 +53,7 @@ $.widget( "ui.popup", {
|
|||||||
this._bind(this.element, {
|
this._bind(this.element, {
|
||||||
// TODO also triggered when open and clicking the trigger again
|
// TODO also triggered when open and clicking the trigger again
|
||||||
// figure out how to close in that case, while still closing on regular blur
|
// figure out how to close in that case, while still closing on regular blur
|
||||||
//blur: "_close"
|
//blur: "close"
|
||||||
});
|
});
|
||||||
|
|
||||||
this._bind({
|
this._bind({
|
||||||
@ -61,7 +61,7 @@ $.widget( "ui.popup", {
|
|||||||
// bind to document instead?
|
// bind to document instead?
|
||||||
keyup: function( event ) {
|
keyup: function( event ) {
|
||||||
if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
|
if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
|
||||||
this._close( event );
|
this.close( event );
|
||||||
this.options.trigger.focus();
|
this.options.trigger.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ $.widget( "ui.popup", {
|
|||||||
this._bind(document, {
|
this._bind(document, {
|
||||||
click: function( event ) {
|
click: function( event ) {
|
||||||
if (this.open && !$(event.target).closest(".ui-popup").length) {
|
if (this.open && !$(event.target).closest(".ui-popup").length) {
|
||||||
this._close( event );
|
this.close( event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -114,7 +114,7 @@ $.widget( "ui.popup", {
|
|||||||
this._trigger( "open", event );
|
this._trigger( "open", event );
|
||||||
},
|
},
|
||||||
|
|
||||||
_close: function( event ) {
|
close: function( event ) {
|
||||||
this.element
|
this.element
|
||||||
.hide()
|
.hide()
|
||||||
.attr( "aria-hidden", true )
|
.attr( "aria-hidden", true )
|
||||||
|
Loading…
Reference in New Issue
Block a user