简体   繁体   中英

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

I've been following the web intents documentation on https://dev.twitter.com/docs/intents#follow-intent which describes that the links need to be as follows:

intent/user?screen_name=xxx

but preferably

intent/user?user_id=xxx

Using the first example displays the styled twitter button, but using user_id does not.

Using 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>  

Using 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>  

Is there a way to style the button if using user_id instead of screen_name

Yes. You can set the use the .split() method on the href value splitting by "?" , or split("?").

Then write if and else if statements. One for starting with screen name and one for user name, then you can apply styles using jQuery's .attr() to apply the class you want as defined in you stylesheet.

Does this answer your question?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM