В исходном коде много ошибок, неправильные селекторы, глобальные переменные используются неправильно, и это идеально подходит для демонстрации плагинов.
(function($){
// Make it a plugin
$.fn.twicker = function(settings) {
// Default Variables
var c = {time: 1300};
// Override the variables with the settings if available.
$.extend(c, settings);
var $t = $(this);
// If we find a ul, means we passed the container (a div that contains a ul)
if($('ul', $t).length == 1) {
$tw = $t;
$t = $('li', $t).first();
}
// Do the animation.
$t.delay(c.time).fadeIn(c.time, function() {
// If there's a next sibling, do next.
if($t.next().length != 0) {
$t.next().twicker();
$t.next().fadeOut();
// If there's no sibling, it means we're at the end. Go back to first.
} else {
$tw.first().twicker();
$t.first().fadeOut();
}
$t.fadeOut(c.time);
});
};
})(jQuery);
$('#twitnews').twicker({time:2000});
Вы можете посмотреть это в прямом эфире на JSFiddle