Only setup event handlers once document is ready
This commit is contained in:
parent
81642bc854
commit
9ad27215ab
1 changed files with 23 additions and 23 deletions
|
@ -58,14 +58,13 @@ $(document).ready(function() {
|
||||||
endAudio: '/audio/ding.mp3',
|
endAudio: '/audio/ding.mp3',
|
||||||
preloadAudio: false,
|
preloadAudio: false,
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$('#scroll-top').on('click', function() {
|
$('#scroll-top').on('click', function() {
|
||||||
scrollTo(0);
|
scrollTo(0);
|
||||||
resetHash();
|
resetHash();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a[href^="#"]').on('click', function(event) {
|
$('a[href^="#"]').on('click', function(event) {
|
||||||
if (this.dataset.noPreventDefault === undefined) {
|
if (this.dataset.noPreventDefault === undefined) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
resetHash();
|
resetHash();
|
||||||
|
@ -74,9 +73,9 @@ $('a[href^="#"]').on('click', function(event) {
|
||||||
if (target.length) {
|
if (target.length) {
|
||||||
scrollTo(target.offset().top);
|
scrollTo(target.offset().top);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.content img').on('click', function(event) {
|
$('.content img').on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const lightbox = $('#lightbox-modal');
|
const lightbox = $('#lightbox-modal');
|
||||||
lightbox.find('img').remove();
|
lightbox.find('img').remove();
|
||||||
|
@ -84,4 +83,5 @@ $('.content img').on('click', function(event) {
|
||||||
.clone()
|
.clone()
|
||||||
.appendTo(lightbox.find('.modal-content'));
|
.appendTo(lightbox.find('.modal-content'));
|
||||||
lightbox.modal();
|
lightbox.modal();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue