【问题标题】:How to remove "followers" text from Twitter Follow Button?如何从 Twitter 关注按钮中删除“关注者”文本?
【发布时间】:2012-01-15 13:36:25
【问题描述】:

我已经成功地让 Twitter 关注按钮工作了。该按钮显示用户拥有多少当前关注者(即:34.3K 关注者)。现在的问题是如何从 twitter 关注按钮中删除文本“关注者”?

我使用下面的代码来渲染按钮:

<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitter.com/twitterusername" class="twitter-follow-button" data-width="160px" data-show-screen-name="false" data-align="middle">Follow twitterusername</a>

有没有办法通过给链接一个数据属性来删除“关注者”文本?任何其他解决方案都会有所帮助。

TIA

埃拉尔夫

【问题讨论】:

    标签: php twitter


    【解决方案1】:

    您可以使用document.getElementsByTagName('iframe')访问iframe(twitter按钮使用iframe加载数据),然后插入以下CSS:

    [id=follow-button] span.label { padding-left: 16px!important; }
    [id=follow-button] [id=l] { display: none!important; }
    

    请注意,iframe 是动态插入到 DOM 中的,这意味着您必须等待它被加载。

    【讨论】:

    • 不能修改 iframe,否则会违反跨域访问。
    猜你喜欢
    • 2012-06-08
    • 2020-02-01
    • 2013-01-25
    • 2017-12-24
    • 2017-10-08
    • 2014-07-06
    • 2011-09-08
    • 1970-01-01
    • 2014-01-06
    相关资源
    最近更新 更多