Quote Rotator Component

A tiny, dependency-free rotator that swaps quotes every 10 seconds and uses an ARIA live region for accessibility.

Live Demo

This area updates automatically.

Source (drop-in)

<span id="quote-rotator" aria-live="polite"></span>
<script>(function(){
  const quotes = [
    { text: "Words are, in my not-so-humble opinion, our most inexhaustible source of magic.", by: "J.K. Rowling" },
    { text: "A writer should be joyous, an optimist … a believer in the perfectibility of man.", by: "John Cheever" }
  ];
  const el = document.getElementById('quote-rotator');
  if (!el) return;
  let i = 0;
  function render(){ const q = quotes[i]; el.textContent = `“${q.text}” — ${q.by}`; i = (i+1) % quotes.length; }
  render(); setInterval(render, 10000);
})();</script>

This is the same pattern used in the site footer.

← Back to Coding Projects