]> iEval git - gruntmaster-page.git/blame - js/10-modal.js
Depend on compiler.jar for JS compilation, move js into static/js/
[gruntmaster-page.git] / js / 10-modal.js
CommitLineData
7093e9ba 1var modal, hiding;
0f578ab0 2
7093e9ba
MG
3function show_modal () {
4 modal.classList.remove('hidden');
5 setTimeout(function (){
6 document.body.classList.add('modal-open');
7 }, 20);
8}
0f578ab0 9
7093e9ba
MG
10function hide_modal () {
11 document.body.classList.remove('modal-open');
12}
0f578ab0 13
7093e9ba
MG
14$(function() {
15 modal = $('.modal')[0];
16 $(modal).on('transitionend', function (){
17 if(!document.body.classList.contains('modal-open'))
18 modal.classList.add('hidden');
19 });
20 $('.backdrop,.modal').each(function(el){
21 document.body.appendChild(el);
0f578ab0 22 });
7093e9ba
MG
23 $('#solution').on('click', function (e){
24 show_modal();
25 e.preventDefault();
26 });
27 $('.backdrop').on('click', hide_modal);
28 window.onkeyup = function (event) {
29 if (event.keyCode === 27)
30 hide_modal();
31 }
32});
This page took 0.025074 seconds and 4 git commands to generate.