mirror of
https://github.com/miggymofongo/asteroid.git
synced 2024-12-25 01:19:41 +00:00
declared facts as a constant
This commit is contained in:
parent
f45d60abba
commit
0313e2f0fd
2 changed files with 8 additions and 4 deletions
|
@ -102,7 +102,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="scripts.js"></script>
|
||||
<script src="./scripts.js"></script>
|
||||
|
||||
|
||||
</section>
|
||||
|
|
10
scripts.js
10
scripts.js
|
@ -17,16 +17,20 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
.then(quotes => {
|
||||
let currentQuoteIndex = 0;
|
||||
const quoteBanner = document.getElementById('quoteBanner');
|
||||
const quoteText = quoteBanner.querySelector('blockquote p');
|
||||
|
||||
function updateQuote() {
|
||||
quoteBanner.textContent = quotes[currentQuoteIndex++];
|
||||
if (currentQuoteIndex >= quotes.length) currentQuoteIndex = 0;
|
||||
quoteText.textContent = quotes[currentQuoteIndex];
|
||||
currentQuoteIndex = (currentQuoteIndex + 1) % quotes.length;
|
||||
}
|
||||
|
||||
updateQuote();
|
||||
setInterval(updateQuote, 5000);
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error loading JSON:', error));
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue