嵌入式Twitter Widget Height问题 [英] Embedded Twitter Widget Height issue
问题描述
我正在尝试将Twitter小部件添加到我的网站,但是小部件的高度有问题。有时它可以工作,有时它会忽略height值并拉伸页面,以便在底部有很多空白空间(将小部件拉伸到7847px)。我尝试在代码中添加高度并设置DIV高度,但仍然可以。这是我从Twitter使用的代码
I am trying to add the Twitter widget to my website but I am having a problem with the height of the widget. Sometimes it works, other times it ignores the height value and stretches the page so that there is a lot of empty space at the bottom (stretches the widget to 7847px). I have tried adding height within the code and setting the DIV height but it still does it. This is the code I am using from Twitter
<a class="twitter-timeline" data-chrome="nofooter noheader noborders noscrollbar transparent" height='350' data-tweet-limit="5" data-dnt="true" href="https://twitter.com/Talk_AVFC/villa-players" data-widget-id="362602509207994368">Tweets from @Talk_AVFC/villa-players</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
有人遇到此问题并知道解决方法吗?
Anybody have this issue and know a fix?
问题演示在这里 http://richardawarner.co.uk/astonvillastuff/ (在Twitter选项卡)
Demo of issue is here http://richardawarner.co.uk/astonvillastuff/ (on the Twitter tab)
推荐答案
可以通过向链接添加数据属性来设置最大宽度和高度:
The maximum width and height can be set by adding data attributes to the link:
<a class="twitter-timeline" data-width="350" .... >
设置显示的窗口小部件的高度,覆盖用$存储的值b $ b小部件ID。必须大于200像素。
Set the height of a displayed widget, overriding the value stored with the widget ID. Must be greater than 200 pixels.
注意:指定tweet-limit参数
时,height参数不适用
Note: the height parameter does not apply when a tweet-limit parameter is specified
https:// dev。 twitter.com/web/embedded-timelines/parameters
这篇关于嵌入式Twitter Widget Height问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!