My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
NewsTicker  

jquery, javascript
Updated Jan 7, 2010 by heriniai...@gmail.com

Maybe an idea for news ticker

function setupFadeLinks() {
arrFadeLinks[0] = 'http://twitter.com/ebayinkblog/statuses/7448070680';
arrFadeTitles[0] = 'RT @vendio: Vendable Blog Post - When eBay Sellers Cannot Win With Ret...';
arrFadeLinks[1] = 'http://twitter.com/ebayinkblog/statuses/7446817439';
arrFadeTitles[1] = 'RT @PayPal: New on The PayPal Blog: Independent Research Study: PayPal...';
arrFadeLinks[2] = 'http://twitter.com/ebayinkblog/statuses/7446806670';
arrFadeTitles[2] = 'RT @eCommerceMerch: eCommerce Merchants Radio Show - Top 10 Trends for...';
arrFadeLinks[3] = 'http://twitter.com/ebayinkblog/statuses/7419220468';
arrFadeTitles[3] = 'RT @InsideRetailing: PayPal available to Blackberry users http://bit.l...';
arrFadeLinks[4] = 'http://twitter.com/ebayinkblog/statuses/7417106720';
arrFadeTitles[4] = '@ninhotline I realize you\'re in Egypt through the end of this week but...';
arrFadeLinks[5] = 'http://twitter.com/ebayinkblog/statuses/7411057645';
arrFadeTitles[5] = '@redINKdiary Happy New Year Henrietta! Here\'s to a happy, healthy and ...';
}

// set this to the number of seconds (decimals are allowed) to delay between links
var delaySeconds = 5;
// set this to the number of seconds (decimals are allowed) to delay after mousing off a link
var mouseLeaveDelaySeconds = 5;
// set this to the ID of the link
var linkId = 'fade_link';

// don't change anything below
var arrFadeLinks;
var arrFadeTitles;

jQuery(document).ready(function(){
	arrFadeLinks = new Array();
	arrFadeTitles = new Array();
	setupFadeLinks();
	
	var $links = jQuery('#' + linkId);
	var lastLink = arrFadeLinks.length - 1;
	var currentLink = 0; 

	scrollLinks = function() {
		if (currentLink > lastLink) {
			currentLink = 0;
		}
		
		$links.text(arrFadeTitles[currentLink]).attr('href', arrFadeLinks[currentLink]);
		
		currentLink ++;
	}
	
	scrollLinks();
	var scroll = setInterval(scrollLinks, delaySeconds * 1000);
	
	$links.bind('mouseenter',function(){
		clearInterval(scroll);
	})
	.bind('mouseleave',function(){
		scroll = setInterval(scrollLinks, mouseLeaveDelaySeconds * 1000);
	});
});

Sign in to add a comment
Powered by Google Project Hosting