Created
November 28, 2012 04:05
-
-
Save ophentis/4158967 to your computer and use it in GitHub Desktop.
customized twitter share by javascript without twitter api
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
//@requires jQuery to find width and height of window and creating querystring | |
var href = 'http://twitter.com/share'; | |
var option = { | |
url: 'your location', | |
text: 'your text' | |
}; | |
var width = 575, | |
height = 400, | |
left = ($(window).width() - width) / 2, | |
top = ($(window).height() - height) / 2, | |
url = $(this).attr('href'), | |
opts = 'status=1' | |
+ ',width=' + width | |
+ ',height=' + height | |
+ ',top=' + top | |
+ ',left=' + left; | |
window.open(href + '?' + $.param(option), 'Twitter Share', opts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment