The below script doesn't fire when visiting the page using the back button on browsers. Is there a way to have it fire regardless of how the page is accessed?
window.onload = function() {
var quotes = $(".head-banner");
var quoteIndex = -1;
function showNextQuote() {
++quoteIndex;
quotes.eq(quoteIndex % quotes.length).fadeIn(1500).delay(4500).fadeOut(1500, showNextQuote);
}
showNextQuote();
}();
/* Background Transitions */
window.onload = function() {
var images = ["https://unsplash.it/1800/1600?image=1006", "https://unsplash.it/1800/1600?image=1008"];
var imageIndex = -1;
function showNextImage() {
++imageIndex;
var imgUrl = images[imageIndex % images.length];
$('#header').css('background-image', 'url(' + imgUrl + ')');
$('#header').fadeIn(1500).delay(4500).fadeOut(1500, showNextImage);
}
showNextImage();
}();
edit: since posting this I have learned what a carousel is