hugo-theme-introduction/static/js/index.js
2018-07-01 13:08:26 +02:00

22 lines
584 B
JavaScript

// 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).attr('data-target')).addClass('is-active');
});
$('.modal-close').click(function () {
$($(this).attr('data-target')).removeClass('is-active');
});
$(document).keypress(function(e) {
if(e.which == 0) {
$('.modal.is-active').removeClass('is-active');
}
});