javascript - Twitter share button without the twitter icon, just the sharing - Stack Overflow

I want to embed the twitter share option and the code I get is the javascript as well as this link to s

I want to embed the twitter share option and the code I get is the javascript as well as this link to share:

<a href="" class="twitter-share-button" data-text="Check out this link please" data-via="ObiWanKobi" data-related="User">Tweet</a>

I want the data text and all that to show BUT I want to use my own custom icon and not the twitter icon. So I took away the class="twitter-share-button" because that is what displays this button but once I do that then the data-text is lost and it just shares the link. How does one hack this to show a custom icon?

Your help = greatly appreciated

I want to embed the twitter share option and the code I get is the javascript as well as this link to share:

<a href="https://twitter./share" class="twitter-share-button" data-text="Check out this link please" data-via="ObiWanKobi" data-related="User">Tweet</a>

I want the data text and all that to show BUT I want to use my own custom icon and not the twitter icon. So I took away the class="twitter-share-button" because that is what displays this button but once I do that then the data-text is lost and it just shares the link. How does one hack this to show a custom icon?

Your help = greatly appreciated

Share Improve this question asked Apr 1, 2014 at 6:56 ObiWanKobiObiWanKobi 1932 silver badges14 bronze badges 1
  • I got it to work using <a href="http://twitter./share?url=http%3A%2F%2Ftwitter./WiggidyWhoa&text=Follow%20the%20%Wiggidy%20Whoa%20 target="_blank"> So yes, build your own URL. This had to be researched though. Know the parameters or look em up. – ObiWanKobi Commented Apr 1, 2014 at 11:49
Add a ment  | 

1 Answer 1

Reset to default 8

Simplest way to do this is by not using their JavaScript at all, and simply building the share URL yourself:

http://twitter./share?text={…}&url={…}

Don’t forget to URL-encode parameter values you put in there properly.

You might want to add a target="_blank" to the link to open this in a new window/tab, or even add window.open to optionally open it in a popup with a predefined width and height.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745122109a4612474.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信