Feed目前显示四个新闻报道。如何增加它以包含4个以上的新闻报道? 我试过了:
var feed.setNumEntries(20); after
var feed ="http://feeds.bbci.co.uk/news/uk/rss.xml";
但它似乎不起作用
<!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>
答案 0 :(得分:3)
试试这个:
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);
示例:jsFiddle
This thread表明缺少文档是因为GFdynamicFeedControl
不再处于积极开发阶段。相反,他们建议使用Google Feed API。
无论如何,我在JS source code找到答案。另请注意,除了传递numResults之外,您还可以设置一组选项:
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
};