mirror of
https://gitlab.com/tildes/tildes.git
synced 2026-04-16 06:18:34 +02:00
Use "outer" sizes for checking dropdown overflow
The "outer" width/height functions also include padding and border. Not including these didn't make a noticeable difference for the left/right flipping (the omissions almost canceled each other out), but the discrepancy is much more noticeable on the top/bottom flipping.
This commit is contained in:
@@ -32,12 +32,12 @@ $.onmount(".dropdown-toggle", function() {
|
||||
.parent()
|
||||
.toggleClass(
|
||||
"dropdown-right",
|
||||
$this.offset().left + $this.width() - $menu.width() > 0
|
||||
$this.offset().left + $this.outerWidth() - $menu.outerWidth() > 0
|
||||
);
|
||||
|
||||
// If the menu extends past the bottom of the viewport, or the site footer
|
||||
// overlaps the menu, push the menu above the button instead.
|
||||
var menuBottom = $this.offset().top + $this.height() + $menu.height();
|
||||
var menuBottom = $this.offset().top + $this.outerHeight() + $menu.outerHeight();
|
||||
var viewportHeight = $(window).height();
|
||||
var scrollTop = $(document).scrollTop();
|
||||
var footerTop = $("#site-footer").offset().top;
|
||||
|
||||
Reference in New Issue
Block a user