InlineTweet.js allows you to easily create tweetable links out of any text on a webpage. Just wrap the tweetable text in a container with data-inline-tweet and you're good to go!
29 | UPDATE: 30 | You can now use InlineTweet.js in Wordpress with this new plugin! 31 | 32 | (Check it out) 33 |
34 | 35 | 36 |Download the file from here and include it in your webpage.
46 |<script src="path/to/inline-tweet.min.js"></script>47 |
Wrap the tweetable text in a container element of your choice (span recommended) with the data attribute, data-inline-tweet
<span data-inline-tweet>Lorem Khaled Ipsum is a major key to success</span>56 |
You can add more data attributes to cutomise the tweeted output -
63 |data-inline-tweet-via — Add a twitter username (without the @) to append to the tweet data-inline-tweet-tags - Add hashtags to the tweet (comma-separated, no spaces)data-inline-tweet-url — Tweet a URL different to the current page url<span data-inline-tweet 69 | data-inline-tweet-via="ireaderinokun" 70 | data-inline-tweet-tags="webdesign,webdev,js,yolo" 71 | data-inline-tweet-url="bitsofco.de"> 72 | Lorem Khaled Ipsum is a major key to success 73 | </span>74 |
Add the following styles to your stylesheet -
80 | 81 |[data-inline-tweet] a {
82 | text-decoration: none;
83 | color: #000;
84 | }
85 | [data-inline-tweet] a span {
86 | border-bottom: 1px dotted rgb(0,172,237);
87 | font-style: italic;
88 | margin-right: 10px;
89 | }
90 | [data-inline-tweet] a:hover span {
91 | background-color: rgba(0,172,237,0.1);
92 | color: rgb(0,172,237);
93 | }
94 | Made with by @IreAderinokun
101 | 102 |