我目前正在使用knockoutJS示例从twitter获取信息。 我想在MetroJS Live Tile上创建一个twitter feed。我得到了所有的信息,但是实时图块并不是通过获得的推特源进行循环播放。
以下是Live Tile的HTML
<div class="red">
<div id="tile1" data-mode="carousel" data-start-now="true" class="live-tile" data-direction="horizontal" data-delay="3000" data-bind='foreach: currentTweets' data-play-onhover="true">
<div>
<div>
<img class="full" data-bind='attr: { src: profile_image_url }' alt=":(" />
</div>
<div>
<span class="tile-title"><a class='twitterUser' data-bind='attr: { href: "http://twitter.com/" + from_user }, text: from_user' href='http://twitter.com/${ from_user }'></a></span>
</div>
<div>
<p class="metroExtraLarge" data-bind="text: text"></p>
</div>
</div>
</div>
以下是带项目示例的 Fiddle (不确定如何添加Metrojs.js文件以便它可以正常工作)。
答案 0 :(得分:1)
Metro JS会在调用.liveTile后立即抓取磁贴面,因此在调用.liveTile之前,磁贴面(或至少它们的容器)需要存在。您可以在绑定内容后调用.liveTile,也可以添加一些占位符div并提取一定数量的推文。
我的网站上还有一个animationComplete示例,它使用隐藏的html元素作为数据源。 http://www.drewgreenwell.com/projects/metrojs#fiddle_9w98S