在推特上隐藏单词"followers" 关注按钮



有没有办法修改Twitter的"关注"按钮以显示气泡中的关注者数量,但隐藏"关注者"一词? 我基本上希望我的"关注"按钮看起来与"推文"按钮相同。

当前代码如下所示:

<a href="https://twitter.com/User" class="twitter-follow-button" data-show-count="true" 
data-show-screen-name="false" data-dnt="true">Follow @User</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>

我遇到了同样的问题,并通过基本上隐藏"追随者"一词并在气泡上创建一个假的右边缘来解决它,如果这有意义的话。因此,您必须将按钮包装在其自己的div 中,然后隐藏该div 的溢出,并将宽度设置为单词消失的确切点,并将高度精确设置为您正在使用的按钮的高度。下面是一个代码示例:

#titter-div {
    border-radius: 4px; /* to mimic the curved edges of the count box */
    border-right: 1px solid #AAAAAA; /* this is the width and color of the count box border */
    height: 20px; /* this height works for the medium button */
    width: 88px; /* precise width to hide the word */
    overflow: hidden; /* actually hides the word */
}

这对我有用,可以准确地创建您正在寻找的东西。希望这有帮助。

要在气泡中显示关注者的数量但隐藏"关注者"一词,这是我与 iframe 一起使用的代码:

<iframe
  src="//platform.twitter.com/widgets/follow_button.html?screen_name=Vacance_Luberon&show_screen_name=false"
  style="width: 88px; height: 20px;"
  allowtransparency="true"
  frameborder="0"
  scrolling="no">
</iframe>

最新更新