Issue
The feeds currently shows four news stories. How do I increase it so that it contains more than four news stories? I have tried:
var feed.setNumEntries(20); after
var feed ="http://feeds.bbci.co.uk/news/uk/rss.xml";
But it doesn't seem to work.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>World Travel online</title>
<link href="styles/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js"
type="text/javascript"></script>
<style type="text/css">
@import url("http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css");
#feedControl {
margin-top : 10px;
margin-left: auto;
margin-right: auto;
width : 400px;
font-size: 12px;
color: #9CADD0;
}
</style>
<script type="text/javascript">
function load() {
var feed ="http://feeds.bbci.co.uk/news/uk/rss.xml";
new GFdynamicFeedControl(feed, "feedControl");
}
google.load("feeds", "1");
google.setOnLoadCallback(load);
</script>
<div id="body">
<div id="feedControl">Loading...</div>
</div>
Solution
Try this:
function load() {
var feed ="http://feeds.bbci.co.uk/news/uk/rss.xml";
new GFdynamicFeedControl(feed, "feedControl", {numResults:8});
}
google.load("feeds", "1");
google.setOnLoadCallback(load);
Example: jsFiddle
This thread suggests the lack of documentation is because GFdynamicFeedControl
is no longer under active development. Instead they recommend using Google Feed API.
Regardless, I found the answer in the JS source code. Also note that in addition to passing numResults, you can set a bunch of options:
this.options = {
numResults : GFdynamicFeedControl.DEFAULT_NUM_RESULTS,
feedCycleTime : GFdynamicFeedControl.DEFAULT_FEED_CYCLE_TIME,
linkTarget : google.feeds.LINK_TARGET_BLANK,
displayTime : GFdynamicFeedControl.DEFAULT_DISPLAY_TIME,
transitionTime : GFdynamicFeedControl.DEFAULT_TRANSISTION_TIME,
transitionStep : GFdynamicFeedControl.DEFAULT_TRANSISTION_STEP,
fadeOutTime: GFdynamicFeedControl.DEFAULT_FADEOUT_TIME,
scrollOnFadeOut : true,
pauseOnHover : true,
hoverTime : GFdynamicFeedControl.DEFAULT_HOVER_TIME,
autoCleanup : true,
transitionCallback : null,
feedTransitionCallback : null,
feedLoadCallback : null,
collapseable : false,
sortByDate : false,
horizontal : false,
stacked : false,
title : null
};
Answered By - Justin Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.