JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<ul id="ticker">
<li>
Sample note 1
</li>
<li>
Sample note 2
</li>
<li>
Sample note 3
</li>
</ul>
JavaScript
function ticker(el, duration) {
if (!el) {
return false;
}
else {
el = typeof el === 'object' ? el : $(el);
duration = duration || 500;
var lis = el.find('li').css('display', 'none');
lis.first().fadeIn(duration, function(){
$(this).slideUp(duration, function(){
$(this).insertAfter(lis.last());
ticker(el, duration);
});
});
}
}
ticker($('#ticker'), 1000);