diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-20 23:03:32 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-20 23:03:32 +0000 |
commit | aba238f57753f391bb15cf43bc5ff23cb943e470 (patch) | |
tree | 757e5727d74456f02745e0e57220511427f2ed6f | |
parent | 4f63f22f5f271c5cac8e7f3ce828f41ebdda5ca4 (diff) | |
download | elgg-aba238f57753f391bb15cf43bc5ff23cb943e470.tar.gz elgg-aba238f57753f391bb15cf43bc5ff23cb943e470.tar.bz2 |
Refs #2493 - merged [7008] into trunk from 1.7 branch
git-svn-id: http://code.elgg.org/elgg/trunk@7108 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/profile/views/default/profile/javascript.php | 57 | ||||
-rw-r--r-- | mod/riverdashboard/views/default/riverdashboard/js.php | 3 |
2 files changed, 33 insertions, 27 deletions
diff --git a/mod/profile/views/default/profile/javascript.php b/mod/profile/views/default/profile/javascript.php index a408d1c84..d7355e118 100644 --- a/mod/profile/views/default/profile/javascript.php +++ b/mod/profile/views/default/profile/javascript.php @@ -20,16 +20,19 @@ var submenuLayer = 1000; -function setup_avatar_menu() { +function setup_avatar_menu(parent) { + if (!parent) { + parent = document; + } // avatar image menu link - $("div.usericon img").mouseover(function() { + $(parent).find("div.usericon img").mouseover(function() { // find nested avatar_menu_button and show $(this.parentNode.parentNode).children(".avatar_menu_button").show(); $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow"); //$(this.parentNode.parentNode).css("z-index", submenuLayer); }) - .mouseout(function() { + .mouseout(function() { if($(this).parent().parent().find("div.sub_menu").css('display')!="block") { $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow"); $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_on"); @@ -47,44 +50,44 @@ function setup_avatar_menu() { // avatar contextual menu - $(".avatar_menu_button img").click(function(e) { - + $(".avatar_menu_button img").click(function(e) { + var submenu = $(this).parent().parent().find("div.sub_menu"); - + // close submenu if arrow is clicked & menu already open if(submenu.css('display') == "block") { - //submenu.hide(); + //submenu.hide(); } else { // get avatar dimensions var avatar = $(this).parent().parent().parent().find("div.usericon"); //alert( "avatarWidth: " + avatar.width() + ", avatarHeight: " + avatar.height() ); - + // move submenu position so it aligns with arrow graphic if (e.pageX < 840) { // popup menu to left of arrow if we're at edge of page submenu.css("top",(avatar.height()) + "px") .css("left",(avatar.width()-15) + "px") - .fadeIn('normal'); - } + .fadeIn('normal'); + } else { submenu.css("top",(avatar.height()) + "px") .css("left",(avatar.width()-166) + "px") - .fadeIn('normal'); - } - - // force z-index - workaround for IE z-index bug + .fadeIn('normal'); + } + + // force z-index - workaround for IE z-index bug avatar.css("z-index", submenuLayer); avatar.find("a.icon img").css("z-index", submenuLayer); submenu.css("z-index", submenuLayer+1); - + submenuLayer++; - + // change arrow to 'on' state $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow"); $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover"); $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_on"); } - + // hide any other open submenus and reset arrows $("div.sub_menu:visible").not(submenu).hide(); $(".avatar_menu_button").removeClass("avatar_menu_arrow"); @@ -102,7 +105,7 @@ function setup_avatar_menu() { $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_hover"); }) // if menu not shown revert arrow, else show 'menu open' arrow - .mouseout(function() { + .mouseout(function() { if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover"); $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow"); @@ -114,25 +117,25 @@ function setup_avatar_menu() { $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_on"); } }); - - // hide avatar menu if click occurs outside of menu - // and hide arrow button - $(document).click(function(event) { + + // hide avatar menu if click occurs outside of menu + // and hide arrow button + $(document).click(function(event) { var target = $(event.target); - if (target.parents(".usericon").length == 0) { + if (target.parents(".usericon").length == 0) { $(".usericon div.sub_menu").fadeOut(); $(".avatar_menu_button").removeClass("avatar_menu_arrow"); $(".avatar_menu_button").removeClass("avatar_menu_arrow_on"); $(".avatar_menu_button").removeClass("avatar_menu_arrow_hover"); $(".avatar_menu_button").hide(); } - }); - + }); + } $(document).ready(function() { - setup_avatar_menu(); - + setup_avatar_menu(); + }); diff --git a/mod/riverdashboard/views/default/riverdashboard/js.php b/mod/riverdashboard/views/default/riverdashboard/js.php index dc26a7e5d..2b761cdcd 100644 --- a/mod/riverdashboard/views/default/riverdashboard/js.php +++ b/mod/riverdashboard/views/default/riverdashboard/js.php @@ -90,4 +90,7 @@ }); }); + + // re-add avatar menus for new avatars + //setup_avatar_menu($('.river_item_list')); </script> |