4

提要目前显示四个新闻报道。如何增加它以使其包含超过 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>
4

1 回答 1

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

该线程表明缺少文档是因为GFdynamicFeedControl不再处于积极开发中。相反,他们建议使用Google Feed API

无论如何,我在JS 源代码中找到了答案。另请注意,除了传递 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
  };
于 2013-05-17T00:27:32.847 回答