From daca1fe109da3b57005cfe77c27819f9666c646d Mon Sep 17 00:00:00 2001 From: Hanzei Date: Sun, 1 Jul 2018 10:09:29 +0200 Subject: Use baseof temple to dry code --- static/js/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 static/js/index.js (limited to 'static') diff --git a/static/js/index.js b/static/js/index.js new file mode 100644 index 0000000..847d6a4 --- /dev/null +++ b/static/js/index.js @@ -0,0 +1,22 @@ +// Bitty scrolling links script +$('a[href^="#"]').click(function(e) { + e.preventDefault(); + $('html, body').animate({ + scrollTop: $(this.hash).offset().top + }, 500); + $("#nav-menu").removeClass("is-active"); + return true; +}) + +// Modal closer +$('.card').click(function () { + $('#'+this.id+'.modal').addClass('is-active'); +}); +$('.modal-close').click(function () { + $('#'+$(this).parent('.modal').get(0).id+'.modal').removeClass('is-active'); +}); +$(document).keypress(function(e) { + if(e.which == 0) { + $('.modal.is-active').removeClass('is-active'); + } +}); -- cgit v1.2.3