有没有办法修改 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 */
}
这对我来说很有用,可以准确地创建您正在寻找的内容。希望这会有所帮助。
关于twitter - 从 Twitter 关注按钮中隐藏单词 "followers",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10874352/