【发布时间】:2014-07-06 17:46:02
【问题描述】:
我在网站上嵌入推文,我想删除关注按钮以及回复、收藏和转推按钮在页脚中。一个最小的 HTML 示例如下
<blockquote class="twitter-tweet">
<a href="https://twitter.com/StackCareers/statuses/468107750333894656"></a>
</blockquote>
<script src="http://platform.twitter.com/widgets.js" charset="utf-8"></script>
通过检查代码,一旦显示推文,我发现按钮被包装如下
<a class="follow-button profile" href="https://twitter.com/StackCareers" role="button" data-scribe="component:followbutton" title="Follow StackOverflowCareers on Twitter"><i class="ic-button-bird"></i>Follow</a>
到目前为止,我尝试使用 JQuery 删除这个类
$('.follow-button.profile').remove()
我还尝试通过在样式表中添加以下行来覆盖 css:
.follow-button {visibility:hidden;}
在post 之后,我也尝试添加这一行
.twt-actions { display: none; }
以上都不起作用。是否有自定义这些嵌入式推文的解决方案?
【问题讨论】:
-
$('.follow-button.profile').remove()工作正常。.follow-button {visibility:hidden;}也是如此。也许它在 iframe 中? -
我使用了 Chrome 代码检查器并在控制台中输入了
$('.follow-button.profile').remove(),它说的是TypeError: Cannot read property 'remove' of null。我还尝试在加载 twitter javascript 后添加此查询,到目前为止还没有运气。你能提供一个最小的例子作为答案吗? -
你是对的,它确实在
iframe中。如何删除 iframe 中的对象?