Created
August 25, 2016 23:45
-
-
Save alana314/f81e083fcfa532d6842014b0d70501c4 to your computer and use it in GitHub Desktop.
jQuery tweet button function using the window URL and content from twitter's meta tag
This file contains hidden or 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
$('a.sharebutton.twitter').click(function(e){ | |
window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent($('meta[name="twitter:description"]').attr('content').substring(0, 116)) + "&url=" + encodeURIComponent(window.location.href),"tweet", "width=500,height=300"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment