mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-02 07:47:32 +00:00
[dropdown widget] improved menu position
This commit is contained in:
parent
5487461541
commit
341d029b9f
@ -58,10 +58,11 @@ define([
|
||||
|
||||
hide: function() {
|
||||
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() {
|
||||
var $toggle = this.$('.sf-dropdown-toggle');
|
||||
var $menu = this.$('.sf-dropdown-menu');
|
||||
app.ui.currentDropdown = this;
|
||||
if (this.options.right) {
|
||||
@ -69,6 +70,9 @@ define([
|
||||
} else {
|
||||
$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');
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user