I have a simple news ticker script that taking scrolling text, but i want that it should take contents from rss feed.
Here is the code
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery.li-scroller.1.0.js"></script>
<link rel="stylesheet" href="li-scroller.css" type="text/css" media="screen" />
<script type="text/javascript">
$(function(){
$("ul#ticker01").liScroll();
$("ul#ticker02").liScroll({travelocity: 0.15});
});
</script>
<ul id="ticker01">
<li><span>10/10/2007</span><a href="#/ogt/content/news/News183.complete">The first thing that most Javascript programmers</a></li>
<li><span>10/10/2007</span><a href="#/ogt/content/news/News175.complete">End up doing is adding some code</a></li>
<li><span>10/10/2007</span><a href="#/ogt/content/news/News177.complete">The code that you want to run</a></li>
</ul>
Anyone can help me in converting simple ticker too rss ticker?
Sorry, I’m no JavaScript guy, but try this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://hamiltonchua.googlecode.com/svn-history/r1/js/jquery/jquery.li-scroller.1.0.js"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssbase/base-min.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssfonts/fonts-min.css" />
<title>
YQL/XML Demo
</title>
</head>
<body>
<ul id="feed"></ul>
<script type="text/javascript" charset="utf-8">
//<![CDATA[
$(document).ready(function(){
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fwww.sitepoint.com%2Fforums%2Fexternal.php%3Ftype%3Dxml%26forumids%3D34'&format=json&callback=?", function(yql){
if(undefined !== yql.query.error){
console.log('YQL Error: ' + yql.query.error);
return;
}
$(yql.query.results.source.thread).each(function(){
$('ul#feed').append('<li>' + this.title + '</li>');
});
});
});
//]]>
</script>
</body>
</html>
It uses YQL to obtain the [URL=“http://www.sitepoint.com/forums/external.php?type=xml&forumids=34”]XML feed for this SitePoint forum in JSON.