X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2F10-modal.js;h=3a8a214a6c1716bda539d27ed58ff7b2313bd0e2;hb=74b0b0abbf8f49d6444c7df9465d943fbad69704;hp=1c290ef1252ce3d236f7c4208efd3fd45c4f3704;hpb=8345760abf4953980a85e0d5f9cade421f73d4ff;p=plack-app-gruntmaster.git diff --git a/js/10-modal.js b/js/10-modal.js index 1c290ef..3a8a214 100644 --- a/js/10-modal.js +++ b/js/10-modal.js @@ -1,7 +1,8 @@ -let modal, hiding; +let modal, backdrop, hiding; function show_modal () { modal.classList.remove('hidden'); + backdrop.classList.remove('hidden'); setTimeout(function (){ document.body.classList.add('modal-open'); }, 20); @@ -13,14 +14,17 @@ function hide_modal () { $(function() { modal = $('.modal')[0]; + backdrop = $('.backdrop')[0]; $(modal).on('transitionend', el => { if(!document.body.classList.contains('modal-open')) modal.classList.add('hidden'); }); $('.backdrop,.modal').each(el => document.body.appendChild(el) ); $('#solution').on('click', e => { - show_modal(); - e.preventDefault(); + if(window.matchMedia("(min-width: 768px)").matches){ + show_modal(); + e.preventDefault(); + } }); $('.backdrop').on('click', hide_modal); window.onkeyup = event => {