1
Fork 0

Only setup event handlers once document is ready

This commit is contained in:
Jake Howard 2022-01-14 19:05:36 +00:00
parent 81642bc854
commit 9ad27215ab
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -58,14 +58,13 @@ $(document).ready(function() {
endAudio: '/audio/ding.mp3',
preloadAudio: false,
});
});
$('#scroll-top').on('click', function() {
$('#scroll-top').on('click', function() {
scrollTo(0);
resetHash();
});
});
$('a[href^="#"]').on('click', function(event) {
$('a[href^="#"]').on('click', function(event) {
if (this.dataset.noPreventDefault === undefined) {
event.preventDefault();
resetHash();
@ -74,9 +73,9 @@ $('a[href^="#"]').on('click', function(event) {
if (target.length) {
scrollTo(target.offset().top);
}
});
});
$('.content img').on('click', function(event) {
$('.content img').on('click', function(event) {
event.preventDefault();
const lightbox = $('#lightbox-modal');
lightbox.find('img').remove();
@ -84,4 +83,5 @@ $('.content img').on('click', function(event) {
.clone()
.appendTo(lightbox.find('.modal-content'));
lightbox.modal();
});
});