<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://meyerweb.com/eric/tools/css/reset/reset.css">
<title>News Ticker</title>
<style>
#newsTicker {
width: 500px;
height: 3em;
border: 10px solid yellowgreen;
margin: 100px auto;
overflow: hidden;
}
#newsTicker > ul > li {
margin-left: 1em;
line-height: 3;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div id="newsTicker">
<ul>
<li>1. Time is gold.</li>
<li>2. No sweat, no sweet.</li>
<li>3. Asking costs nothing.</li>
<li>4. Step by step goes a long way.</li>
<li>5. You will never know until you try.</li>
</ul>
</div>
<script>
var INTERVAL = 2000;
var DURATION = 1000;
var newsList = document.querySelector('#newsTicker > ul');
window.setInterval(function () {
newsList.style.transitionDuration = DURATION + 'ms';
newsList.style.marginTop = '-3em';
window.setTimeout(function () {
newsList.append(newsList.firstElementChild);
newsList.removeAttribute('style');
}, DURATION);
}, INTERVAL)
</script>
</body>
</html>
