Skip to content

Instantly share code, notes, and snippets.

@neopunisher
Created September 9, 2011 17:45
Show Gist options
  • Save neopunisher/1206847 to your computer and use it in GitHub Desktop.
Save neopunisher/1206847 to your computer and use it in GitHub Desktop.
Crossfade list elements
function loopnews(){
var $active = jQuery('div.newsTicker>ul>li.active'),
$next = $active.next('li');
//console.log($next);
if($next.length != 1){
$next = jQuery('div.newsTicker>ul>li:eq(0)')
}
$active.fadeOut(500,function(){
$active.removeClass('active');
$next.addClass('active').fadeIn(1000,function(){
setTimeout(loopnews,3000);
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment