hugo-theme-introduction/assets/js/index.js

25 lines
663 B
JavaScript
Raw Normal View History

2018-07-01 08:09:29 +00:00
// 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 () {
2018-07-01 11:08:26 +00:00
$($(this).attr('data-target')).addClass('is-active');
$("html").addClass("modal-open");
2018-07-01 08:09:29 +00:00
});
$('.modal-close').click(function () {
2018-07-01 11:08:26 +00:00
$($(this).attr('data-target')).removeClass('is-active');
$("html").removeClass("modal-open");
2018-07-01 08:09:29 +00:00
});
$(document).keypress(function(e) {
if(e.which == 0) {
$('.modal.is-active').removeClass('is-active');
}
});