aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-20 02:27:43 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-20 02:27:43 +0000
commite610b6fecf5d9fc6cc58c8a2b44cbe2bb37c22fe (patch)
tree7e11f4242bdcfdf46d922312f5e160760b516323 /js/lib
parent285aa3983c46cf0d3e3afbd9a956cb788471bc82 (diff)
downloadelgg-e610b6fecf5d9fc6cc58c8a2b44cbe2bb37c22fe.tar.gz
elgg-e610b6fecf5d9fc6cc58c8a2b44cbe2bb37c22fe.tar.bz2
Fixes #2947: User hover menu attached to body and shows regardless of overflow.
git-svn-id: http://code.elgg.org/elgg/trunk@8353 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/ui.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index f61e2faea..bd2541ec9 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -111,17 +111,31 @@ elgg.ui.initHoverMenu = function(parent) {
// avatar contextual menu
$(".elgg-avatar > .elgg-icon-hover-menu").live('click', function(e) {
+ // check if we've attached the menu to this element already
+ var $hovermenu = $(this).data('hovermenu') || null;
- var $hovermenu = $(this).parent().find(".elgg-menu-hover");
+ if (!$hovermenu) {
+ var $hovermenu = $(this).parent().find(".elgg-menu-hover");
+ $(this).data('hovermenu', $hovermenu);
+ }
// close hovermenu if arrow is clicked & menu already open
if ($hovermenu.css('display') == "block") {
$hovermenu.fadeOut();
} else {
$avatar = $(this).closest(".elgg-avatar");
- $hovermenu.css("top", ($avatar.height()) + "px")
- .css("left", ($avatar.width()-15) + "px")
+
+ var offset = $avatar.offset();
+ var top = $avatar.height() + offset.top + 'px';
+ var left = $avatar.width() - 15 + offset.left + 'px';
+
+ $hovermenu.appendTo('body')
+ .css('position', 'absolute')
+ .css("top", top)
+ .css("left", left)
.fadeIn('normal');
+ hoverIt = $hovermenu;
+ console.log($hovermenu);
}
// hide any other open hover menus