时间线小部件中的推文

时间线小部件中的推文

本文介绍了有没有办法限制 Twitter 时间线小部件中的推文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用如下所示的 Twitter 时间线小部件,并希望将推文数量限制为 5.默认情况下为 20.嵌入的网站是为使用屏幕阅读器的视障人士设计的.屏幕阅读器被困在小部件中,用户被迫浏览所有 20 条推文才能退出.twitter 的文档中没有更改数字的说明.我愿意使用其他代码.谢谢!

I am using Twitter's timeline widget seen below and would like to limit the number of tweets to 5. It is 20 by default. The website this is being embedded into is for visually impaired people who use screen readers. Screen readers get trapped inside the widget and the user is forced to tab through all 20 tweets to get out. There is no instruction for changing the number in twitter's documentation. I would be open to using other code. Thanks!

<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/myprofile" data-widget-id="3007449998460120999">Tweets by @myprofile</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

推荐答案

您可以将 data 属性设置为 标签以自定义时间线.查看嵌入式时间线文档了解更多选项.

You can set data attributes to the <a> tag to customize the timeline. Look at the Embedded Timeline documentation for more options.

你需要data-tweet-limit=5.

这篇关于有没有办法限制 Twitter 时间线小部件中的推文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 22:04