]> iEval git - plack-app-gruntmaster.git/blobdiff - js/10-modal.js
Replace bootstrap modals with homemade modals
[plack-app-gruntmaster.git] / js / 10-modal.js
diff --git a/js/10-modal.js b/js/10-modal.js
new file mode 100644 (file)
index 0000000..30da267
--- /dev/null
@@ -0,0 +1,30 @@
+;(function(){
+       'use strict';
+
+       function show_modal () {
+               $('.modal').removeClass('hidden');
+               setTimeout(function (){
+                       $('body').addClass('modal-open');
+               }, 20);
+       }
+
+       function hide_modal () {
+               $('body').removeClass('modal-open');
+               $('.modal').one('transitionend', function (){
+                       $('.modal').addClass('hidden');
+               });
+       }
+
+       $( document ).ready(function() {
+               $('.backdrop,.modal').detach().appendTo('body');
+               $('#solution').on('click', function (e){
+                       show_modal();
+                       e.preventDefault();
+               });
+               $('.backdrop').on('click', hide_modal);
+               window.onkeyup = function (event) {
+                       if (event.keyCode === 27)
+                               hide_modal();
+               }
+       });
+})();
This page took 0.023517 seconds and 4 git commands to generate.