mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
feat: prevent consecutive flips of the same testimonial card
This commit is contained in:
parent
d973be8fea
commit
589cb2ac79
1 changed files with 13 additions and 2 deletions
|
@ -706,11 +706,22 @@ aider --model gpt-4o --api-key openai=your-key-goes-here</pre>
|
|||
document.addEventListener('DOMContentLoaded', function() {
|
||||
initializeTestimonials();
|
||||
|
||||
// Track the last flipped card index to avoid repeats
|
||||
let lastFlippedIndex = -1;
|
||||
|
||||
// Rotate one testimonial at a time, randomly selecting which one to change
|
||||
setInterval(function() {
|
||||
// Randomly select which testimonial to update
|
||||
const randomIndex = Math.floor(Math.random() * displayCount);
|
||||
// Select a random index that's different from the last flipped one
|
||||
let randomIndex;
|
||||
do {
|
||||
randomIndex = Math.floor(Math.random() * displayCount);
|
||||
} while (randomIndex === lastFlippedIndex && displayCount > 1);
|
||||
|
||||
// Update the selected testimonial
|
||||
updateSingleTestimonial(randomIndex);
|
||||
|
||||
// Store this index as the last flipped
|
||||
lastFlippedIndex = randomIndex;
|
||||
}, 3000);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue