Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kdevo/osprey-delight.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorToma Nistor <toma.nistor@gmail.com>2018-12-26 09:26:56 +0300
committerToma Nistor <toma.nistor@gmail.com>2018-12-26 09:26:56 +0300
commit3f506a5c30cb1431728be6f827fd34611bae7fa6 (patch)
treeb929a956af5b5bbb48f23d681ba96c6ba68ba532 /static
parent0abb05aabff4891348f593a5bb18f9326e556efc (diff)
Added ability to close modals with ESC key, added projectDate param to gallery archetype
Diffstat (limited to 'static')
-rw-r--r--static/scripts/modal.min.js2
-rw-r--r--static/scripts/src/modal.js10
2 files changed, 9 insertions, 3 deletions
diff --git a/static/scripts/modal.min.js b/static/scripts/modal.min.js
index cfff854..36c5e68 100644
--- a/static/scripts/modal.min.js
+++ b/static/scripts/modal.min.js
@@ -1 +1 @@
-!function(){function t(){i.forEach(function(t){t.classList.remove("scale-out-center")})}function e(){i.forEach(function(t){t.classList.add("scale-out-center")})}var c,n=document.querySelector.bind(document),o=document.querySelectorAll.bind(document),i=o(".modal-box"),u=o(".gallery-modal-link"),a=o(".close");u.forEach(function(e){e.onclick=function(e){e.preventDefault(),c=n(e.target.getAttribute("href")),c.classList.add("active"),t()}}),a.forEach(function(t){t.onclick=function(t){t.preventDefault(),e(),setTimeout(function(){c.classList.remove("active")},500)}}),window.onclick=function(t){t.target===c&&(e(),setTimeout(function(){c.classList.remove("active")},500))}}(); \ No newline at end of file
+!function(){function t(){i.forEach(function(t){t.classList.remove("scale-out-center")})}function n(){i.forEach(function(t){t.classList.add("scale-out-center"),setTimeout(function(){c.classList.remove("active")},500)})}var c,e=document.querySelector.bind(document),o=document.querySelectorAll.bind(document),i=o(".modal-box"),u=o(".gallery-modal-link"),a=o(".close");u.forEach(function(n){n.onclick=function(n){n.preventDefault(),c=e(n.target.getAttribute("href")),c.classList.add("active"),t()}}),a.forEach(function(t){t.onclick=function(t){t.preventDefault(),n()}}),window.onclick=function(t){t.target===c&&n()},document.onkeydown=function(t){"Escape"===t.key&&n()}}(); \ No newline at end of file
diff --git a/static/scripts/src/modal.js b/static/scripts/src/modal.js
index 8d8b39b..1994ef6 100644
--- a/static/scripts/src/modal.js
+++ b/static/scripts/src/modal.js
@@ -23,6 +23,7 @@
function closeModal() {
modalBoxes.forEach(function(box) {
box.classList.add('scale-out-center')
+ setTimeout(function() { modal.classList.remove('active') }, 500)
})
}
@@ -41,7 +42,6 @@
link.onclick = function(e) {
e.preventDefault()
closeModal()
- setTimeout(function() { modal.classList.remove('active') }, 500)
}
})
@@ -49,7 +49,13 @@
window.onclick = function(event) {
if (event.target === modal) {
closeModal()
- setTimeout(function() { modal.classList.remove('active') }, 500)
+ }
+ }
+
+ // Close modal on ESC key press
+ document.onkeydown = function(e) {
+ if (e.key === 'Escape') {
+ closeModal()
}
}
})()