Created
April 23, 2013 10:33
-
-
Save guillaumepiot/5442501 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTML for the share on Tumblr link: | |
// | |
//<a href="http://onefoolishact.com" title="Website title" data-description="The description goes here" class="tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:31px; height:31px; background:url('http://platform.tumblr.com/v1/share_3.png') top left no-repeat transparent;" target="_blank">Share on Tumblr</a> | |
// | |
// and before the </body> add: | |
// | |
// <script type="text/javascript" src="http://platform.tumblr.com/v1/share.js"></script> | |
$('a.tumblr').click(function(e){ | |
//We tell our browser not to follow that link | |
e.preventDefault(); | |
//We get the URL of the link | |
var loc = escape($(this).attr('href')); | |
var title = escape($(this).attr('title')); | |
var description = escape($(this).attr('data-description')); | |
//We trigger a new window with the Twitter dialog, in the middle of the page | |
window.open('http://www.tumblr.com/share/link?url=' + loc + '&name=' + title + '&description=' + description +'&', 'facebookwindow', 'height=450, width=550, top='+($(window).height()/2 - 225) +', left='+$(window).width()/2 +', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment