Takazudo hamalog

programming notes. mainly about JavaScript / jQuery. [@Takazudo] [takazudo@gmail.com] Hint: alt + /

cool guy

$.fn.twttrintent

2011/08/16 permalink

Web Intents is Twitter’s API which allows users to post tweet easily.

$.fn.twttrintent allows you to specify the “query values” on elements’ data attribute like below. ”query values” are parameters what you want to send to Twitter.

<a
    href="https://twitter.com/intent/tweet"
    class="js-twttrintent"
    data-intent-text="The quick brown fox jumps over the lazy dog."
    data-intent-url="http://example.com"
    data-intent-hashtags="hoge,foo"
>
    TWEEEEEEETTTT
</a>
/* fire */
$(function(){
	// twitter intent 
	$('.js-twttrintent').twttrintent();
});

blog comments powered by Disqus