mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-07 12:28:28 +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:
parent
4596e3876b
commit
0b9101f3c5
2 changed files with 21 additions and 2 deletions
|
@ -1385,7 +1385,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-lightbox-attachments' =>
|
'javelin-behavior-lightbox-attachments' =>
|
||||||
array(
|
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',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -81,7 +81,8 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
|
|
||||||
lightbox = JX.$N('div',
|
lightbox = JX.$N('div',
|
||||||
{
|
{
|
||||||
className : 'lightbox-attachment'
|
className : 'lightbox-attachment',
|
||||||
|
sigil: 'lightbox-attachment'
|
||||||
},
|
},
|
||||||
img
|
img
|
||||||
);
|
);
|
||||||
|
@ -283,4 +284,22 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
lightBoxHandleKeyDown
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue