I've created a rss feed using the Google API and the 'Hello World of RSS 
Feeds' example. I'm basically a novice when it comes to JS and jQuery so 
any help here is much appreciated.
 
I want to add a piece of code that will make my rss feed auto scroll and 
then loop back to the top once it reaches the bottom. Is there any simple 
way to do this?
 
This is the code I've adapted to my needs:
 
 
<html>
<head>
 <title>Google Feed Loader Example #1</title> 
 
 <script type="text/javascript" src="https://www.google.com/jsapi";></script>
 <!--<script type="text/javascript" src="
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js";></script>-->
 
 <script type="text/javascript">
  google.load("feeds", "1");
  // Our callback function, for when a feed is loaded.
 function feedLoaded(result) {
  if (!result.error) {
   // Grab the container we will put the results into
  var container = document.getElementById("feed");
  container.innerHTML = '';
  // Loop through the feeds, putting the titles onto the page.
  // Check out the result object for a list of properties returned in each 
entry.
  // http://code.google.com/apis/ajaxfeeds/documentation/reference.html#JSON
  for (var i = 0; i < result.feed.entries.length; i++) {
    var entry = result.feed.entries[i];
    var div1 = document.createElement("div");
    div1.setAttribute("id", "title");
    div1.innerHTML = '<he3><a href="' + entry.link + '">' + entry.title + 
'</a></h3>';
    //div1.appendChild(document.createTextNode(entry.feedUrl));
    
    var div2 = document.createElement("div");
    div2.setAttribute("id", "description");
    div2.appendChild(document.createTextNode(entry.content));
        
    var div3 = document.createElement("div");
    div3.appendChild(document.createTextNode(entry.publishedDate));
    div3.setAttribute("id", "date");
    
    container.appendChild(div1);
    container.appendChild(div2);
    container.appendChild(div3);
    
    /*var li = document.createElement("li");
          li.innerHTML = '<h3><a href="' + entry.link + '">' + entry.title 
+ '</a></h3>';
          li.innerHTML += '<p>' + entry.contentSnippet + '</p>';
          container.appendChild(li);*/
  }
   }
 }
 function OnLoad() {
   // Create a feed instance that will grab Digg's feed.
   var feed = new google.feeds.Feed("http://www.digg.com/rss/index.xml";);
   feed.setNumEntries(15);
   feed.includeHistoricalEntries();
   // Calling load sends the request off.  It requires a callback function.
   feed.load(feedLoaded);
 }
 google.setOnLoadCallback(OnLoad);
 
 function init() {
    var div = document.getElementById("feed");
    // increase the scroll position by 10 px every 10th of a second
    setInterval(function() { 
        // make sure it's not at the bottom
        if (div.scrollTop < div.scrollHeight - div.clientHeight)
            div.scrollTop += 10; // move down
    }, 100); // 100 milliseconds
 }
 </script>
 
 <style>
 h1 {
 background-color:  #356AA0;
 }
 
 a {
 color:     #FEC659;
 }
 
 a:link {
 text-decoration: none;
 }
 
 a:visited {
 text-decoration: none;
 }
 
 a:hover {
 text-decoration: underline;
 }
 
 a:active {
 text-decoration: underline;
 }
 
 div {line-height: 1;}
 /*h1, p {margin: 0;} */
 
 div#feed {
 width:     330;
 height:    150;
 overflow-y:   auto;
 background-color:  #F8F8F8; /* background-color when image is not shown */
 border-top:   1px solid #C0C0C0;
 border-bottom:  1px solid #C0C0C0; /* set grey border bottom */
 border-left:  1px solid #C0C0C0; /* set grey border left */
 border-right:  1px solid #C0C0C0; /* set grey border right */
 }
 
 div#title {
 /*padding:   5px;*/
 background-color:  #FFFFFF;
 font-size:    14px; /* sets the font size of the title to 18px*/
 font-weight:  bold; /* and bold of course */
 color:    #FEC659;
 text-decoration: none;
 }
 
 div#description {
 color:     #356AA0;
 background-color: #FFFFFF;
 padding-bottom:  5px;
 }
 
 div#date {
 background-color:  #FFFFFF;
 color:    #000000;
 border-bottom:  1px dotted #C0C0C0;
 padding-bottom:  5px;
 }
 
 div#header {
 width:     330;
 background-color:  #356AA0;
 font-size:    18px; /* sets the font size of the title to 18px*/
 font-weight:  bold; /* and bold of course */
 color:    #FFFFFF;
 text-decoration: none;
 }
 
 </style>
 
</head>

<body>
<div id="header">Feed Title </div>
<div id="feed"></div>
</div>
</body>
</html>
 
 
I found something that would work for me here <http://jsfiddle.net/x47Te/3/> 
but 
I can't figure out how to integrate it with my code above. Any help would 
be appreciated!
 
Thanks!
 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
https://groups.google.com/d/msg/google-ajax-search-api/-/WmOL8IbHV6cJ
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to