mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-13 20:56:16 +00:00
[dropdown widget] improved menu position
This commit is contained in:
parent
5487461541
commit
341d029b9f
@ -58,10 +58,11 @@ define([
|
|||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
app.ui.currentDropdown = null;
|
app.ui.currentDropdown = null;
|
||||||
this.$('.sf-dropdown-menu').addClass('hide');
|
this.$('.sf-dropdown-menu').addClass('hide').removeAttr('style'); // `removeAttr('style')`: clear position info
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
|
var $toggle = this.$('.sf-dropdown-toggle');
|
||||||
var $menu = this.$('.sf-dropdown-menu');
|
var $menu = this.$('.sf-dropdown-menu');
|
||||||
app.ui.currentDropdown = this;
|
app.ui.currentDropdown = this;
|
||||||
if (this.options.right) {
|
if (this.options.right) {
|
||||||
@ -69,6 +70,9 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
$menu.css('left', this.options.left);
|
$menu.css('left', this.options.left);
|
||||||
}
|
}
|
||||||
|
if ($toggle.offset().top + $toggle.outerHeight(true) + $menu.outerHeight(true) > $(window).scrollTop() + $(window).height()) {
|
||||||
|
$menu.css({'bottom': $toggle.outerHeight(true) + 4});
|
||||||
|
}
|
||||||
this.$('.sf-dropdown-menu').removeClass('hide');
|
this.$('.sf-dropdown-menu').removeClass('hide');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user