Skip to content

Instantly share code, notes, and snippets.

@faridv
Created November 11, 2018 15:21
Show Gist options
  • Save faridv/03f964fe38ec7f1002fb78269868d10e to your computer and use it in GitHub Desktop.
Save faridv/03f964fe38ec7f1002fb78269868d10e to your computer and use it in GitHub Desktop.
Titles ticker plugin for jQuery
// Ticker Plugin
$.fn.fTicker = function (options) {
var $ticker = $(this);
var settings = $.extend({
// defaults.
timeout: 5000
}, options);
$.each($ticker, function () {
var $el = $(this).find("ul:first");
if ($el.find("li").length < 2)
return false;
window.setInterval(function () {
$el.find('li:first').slideUp(function () {
$(this).appendTo($el).slideDown();
});
}, settings.timeout);
});
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment