aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-26 15:44:49 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-26 15:44:49 +0000
commit34c502d94a0a729c99ad538ecf3e6e4ceeb8353e (patch)
tree2c2596c4bd26d30fde862f9bbc0c898338935ad5 /js
parent1f3befaf97c2840dbd4ecadd8cc62bf838d32a45 (diff)
downloadelgg-34c502d94a0a729c99ad538ecf3e6e4ceeb8353e.tar.gz
elgg-34c502d94a0a729c99ad538ecf3e6e4ceeb8353e.tar.bz2
Fixes #3234, refs #3094. Added the inTarget code back to the popup closing function.
git-svn-id: http://code.elgg.org/elgg/trunk@8842 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js')
-rw-r--r--js/lib/ui.js31
1 files changed, 25 insertions, 6 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 030390823..ecf4cc763 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -107,18 +107,37 @@ elgg.ui.popsUp = function(event) {
*/
elgg.ui.popupClose = function(event) {
$eventTarget = $(event.target);
+ var inTarget = false;
var $popups = $('[rel=popup]');
+ // if the click event target isn't in a popup target, fade all of them out.
$popups.each(function(i, e) {
- var $e = $(e);
- var $target = $(elgg.getUrlFragment($e.attr('href')) + ':visible');
- if ($target.length > 0) {
- $target.fadeOut();
- $e.removeClass('elgg-state-active');
+ var target = elgg.getUrlFragment($(e).attr('href')) + ':visible';
+ var $target = $(target);
+
+ if (!$target.is(':visible')) {
+ return;
+ }
+
+ // didn't click inside the target
+ if ($eventTarget.closest(target).length > 0) {
+ inTarget = true;
+ return false;
}
});
- $('body').die('click', elgg.ui.popClose);
+ if (!inTarget) {
+ $popups.each(function(i, e) {
+ var $e = $(e);
+ var $target = $(elgg.getUrlFragment($e.attr('href')) + ':visible');
+ if ($target.length > 0) {
+ $target.fadeOut();
+ $e.removeClass('elgg-state-active');
+ }
+ });
+
+ $('body').die('click', elgg.ui.popClose);
+ }
}
/**