1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 10:41:08 +01:00

Make lightbox close when the background is clicked

Summary: When you click the dark background, close the lightbox.

Test Plan: Clicked arrows, image, etc., to make sure it didn't close. Clicked background to close.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3801
This commit is contained in:
epriestley 2012-10-23 12:00:45 -07:00
parent 4596e3876b
commit 0b9101f3c5
2 changed files with 21 additions and 2 deletions

View file

@ -1385,7 +1385,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-lightbox-attachments' =>
array(
'uri' => '/res/6ddb05f8/rsrc/js/application/core/behavior-lightbox-attachments.js',
'uri' => '/res/dfc1743a/rsrc/js/application/core/behavior-lightbox-attachments.js',
'type' => 'js',
'requires' =>
array(

View file

@ -81,7 +81,8 @@ JX.behavior('lightbox-attachments', function (config) {
lightbox = JX.$N('div',
{
className : 'lightbox-attachment'
className : 'lightbox-attachment',
sigil: 'lightbox-attachment'
},
img
);
@ -283,4 +284,22 @@ JX.behavior('lightbox-attachments', function (config) {
lightBoxHandleKeyDown
);
// When the user clicks the background, close the lightbox.
JX.Stratcom.listen(
'click',
'lightbox-attachment',
function (e) {
if (!lightbox) {
return;
}
if (e.getTarget() != e.getNode('lightbox-attachment')) {
// Don't close if they clicked some other element, like the image
// itself or the next/previous arrows.
return;
}
closeLightBox(e);
e.kill();
});
});