Fixed a issue when script was loaded before jquery
This commit is contained in:
parent
542c449069
commit
98c5e85be6
|
@ -17,18 +17,29 @@ if (new Date().getMonth() === 11) {
|
||||||
|
|
||||||
// Wait for the snowfall script and jQuery to load
|
// Wait for the snowfall script and jQuery to load
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
$(document).snowfall({
|
defer(proceedWithJquery);
|
||||||
flakeCount: ($(document).width() > 992 ? 500 : 100),
|
|
||||||
flakeIndex: -1,
|
|
||||||
minSize: 4,
|
|
||||||
maxSize: 5,
|
|
||||||
minSpeed: 1,
|
|
||||||
maxSpeed: 2,
|
|
||||||
round: true,
|
|
||||||
shadow: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Change background artist in the footer
|
|
||||||
$('#background-artist').html('<a href="http://www.publicdomainpictures.net/view-image.php?image=28562&picture=christmas-bulbs-red-background">Debi Geroux - Public Domain</a>');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function defer(method) {
|
||||||
|
if (window.jQuery)
|
||||||
|
method();
|
||||||
|
else
|
||||||
|
setTimeout(function() { defer(method) }, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function proceedWithJquery() {
|
||||||
|
$(document).snowfall({
|
||||||
|
flakeCount: ($(document).width() > 992 ? 500 : 100),
|
||||||
|
flakeIndex: -1,
|
||||||
|
minSize: 4,
|
||||||
|
maxSize: 5,
|
||||||
|
minSpeed: 1,
|
||||||
|
maxSpeed: 2,
|
||||||
|
round: true,
|
||||||
|
shadow: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Change background artist in the footer
|
||||||
|
$('#background-artist').html('<a href="http://www.publicdomainpictures.net/view-image.php?image=28562&picture=christmas-bulbs-red-background">Debi Geroux - Public Domain</a>');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue