]>
Commit | Line | Data |
---|---|---|
0f578ab0 MG |
1 | ;(function(){ |
2 | 'use strict'; | |
3 | ||
4 | function show_modal () { | |
5 | $('.modal').removeClass('hidden'); | |
6 | setTimeout(function (){ | |
7 | $('body').addClass('modal-open'); | |
8 | }, 20); | |
9 | } | |
10 | ||
11 | function hide_modal () { | |
12 | $('body').removeClass('modal-open'); | |
13 | $('.modal').one('transitionend', function (){ | |
14 | $('.modal').addClass('hidden'); | |
15 | }); | |
16 | } | |
17 | ||
18 | $( document ).ready(function() { | |
19 | $('.backdrop,.modal').detach().appendTo('body'); | |
20 | $('#solution').on('click', function (e){ | |
21 | show_modal(); | |
22 | e.preventDefault(); | |
23 | }); | |
24 | $('.backdrop').on('click', hide_modal); | |
25 | window.onkeyup = function (event) { | |
26 | if (event.keyCode === 27) | |
27 | hide_modal(); | |
28 | } | |
29 | }); | |
30 | })(); |