<!doctype html>
Business Today Live Ticker
<style>
body {
font-family: Arial, sans-serif;
background: #f9f9f9;
margin: 0;
padding: 0;
}
.ticker-container {
background: #004080;
color: #fff;
overflow: hidden;
white-space: nowrap;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
padding: 10px 0;
}
.ticker {
display: inline-block;
padding-left: 100%;
animation: ticker-scroll 25s linear infinite;
}
.ticker span {
margin-right: 50px;
}
@keyframes ticker-scroll {
0% { transform: translateX(0); }
100% { transform: translateX(-100%); }
}
</style>
<div class="ticker-container">
<div id="ticker" class="ticker">
<span>Loading latest headlines...</span>
</div>
</div>
<script>
async function fetchHeadlines() {
try {
const response = await fetch("https://www.businesstoday.in/news");
const text = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(text, "text/html");
// Adjust selector based on Business Today’s structure
const headlines = [...doc.querySelectorAll("h2, h3")]
.slice(0, 10) // limit to 10 headlines
.map(el => el.textContent.trim());
const ticker = document.getElementById("ticker");
ticker.innerHTML = headlines.map(h => `<span>${h}</span>`).join("");
} catch (err) {
console.error("Error fetching headlines:", err);
}
}
// Initial load
fetchHeadlines();
// Refresh every 5 minutes
setInterval(fetchHeadlines, 300000);
</script>
</!doctype>
0 $type={blogger}:
Post a Comment