使用https://twitter.com/intent/user?user_id=删除按钮样式

Using https://twitter.com/intent/user?user_id= for the follow button remove button styling

本文关键字:user id 删除 按钮 样式 twitter https com intent 使用      更新时间:2023-09-26

我一直在遵循https://dev.twitter.com/docs/intents#follow-intent上的web意图文档,其中描述了链接需要如下:

intent/user?screen_name=xxx

但最好

intent/user?user_id=xxx

使用第一个示例显示样式twitter按钮,但使用user_id不会。

使用screen_name

<a href="https://twitter.com/intent/user?screen_name=twitterapi" 
class="twitter-follow-button" data-show-count="false" data-size="large">
Follow@twitterapi</a>  
使用user_id

<a href="https://twitter.com/intent/user?user_id=6253282" 
class="twitter-follow-    button" data-show-count="false" 
data-size="large">Follow @twitterapi</a>  

是否有一种方法来样式按钮,如果使用user_id而不是screen_name

是。你可以设置使用。split()方法上的href值分割"?",或者split("?")。

然后写if和else if语句。一个以屏幕名开始,另一个以用户名开始,然后可以使用jQuery的.attr()应用样式,以应用样式表中定义的类。

这回答你的问题了吗?