So I found this code online of adding a Twitter button to your website. It basically popups a window allowing the user to tweet the content. However this code doesn’t work in codepen even though it works fine on the local machine.
Any help would be much appreciated.
Codepen page
popup function code
$(’.popup’).click(function(event) {
var width = 575,
href="http://twitter.com/share";
height = 400,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
txt=$("#quote").html().split('.')[0].split(' ').join('%20'),
url = href+"?text="+txt,
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
console.log(opts);
window.open(url, 'twitter', opts);
return false;
});