一直在尝试找出如何删除iframe twitter小部件中的滚动条。我知道无法通过css实现,所以我的下一个尝试是使用jquery。我尝试了以下方法,但似乎没有起作用:
$("iframe").ready(function () {
$(".stream", this).css("overflow-x", "hidden");
});
简单解决方案
在 iframe 标签中将 scrolling 属性设置为 no,就像这样:
scrolling="no"
<iframe scrolling="no" title="Twitter Tweet Button" style="border:0;overflow:hidden;" src="https://platform.twitter.com/widgets/tweet_button.html" height="28px" width="76px"></iframe>
你可以使用 CSS 来禁用它。我使用了这个插件(https://github.com/kevinburke/customize-twitter-1.1)来覆盖 Twitter 的 CSS,然后只需添加:
.timeline .stream {overflow:hidden;}
我也通过将相同的CSS直接添加到本地存储的Twitter widget.js副本中(大约在第30行左右)来隐藏滚动条。