JSFiddle - React, Tailwind, and code Playground

by Oscar Jara

HTML

<script src="http://dl.dropbox.com/u/15208254/stackoverflow/jquery.jgfeed.js"></script>
<iframe id="holder" src="" frameborder="0" scrolling="no"></iframe>

CSS

html, body, iframe {
    height:100%;
    width:100%;
    overflow:hidden;
}

JavaScript

// Array containing pages
var pages = new Array();

// Time in seconds to rotate pages
var time = 30;

// Variable for loop purpose
var i = 1;

$(function(){
    
    $.jGFeed('http://working-rss-url',
      function(feeds){
          
        // Check for feeds
        if(!feeds){
          // There was an error, remote url not ok or no feeds
          return false;
        }
          
        // Do whatever you want with feeds here
        for(var i=0; i<feeds.entries.length; i++){
          var entry = feeds.entries[i];
          // Fill array with entry link
          pages.push(entry);
        }
        
        // If array contains urls
        if(pages.length != 0){
            // Rotate pages every 'x' seconds
            setInterval(function() {
                if(i == pages.length){
                   i = 0;  
                }
                $('#holder').attr('src', pages[i].link);
                i++;
            }, time * 1000);
        }
          
    }, 5); // Number of feeds you want to recover
    
});