Created
March 30, 2014 09:45
-
-
Save andyshora/9870313 to your computer and use it in GitHub Desktop.
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
$(document).ready(function() { | |
// enable on mouseover | |
$('.twitter-share-button-placeholder').bind('mouseover', function() { | |
enableShareButton($(this)); | |
}); | |
// auto enable for mobile | |
if (Modernizr.touch) { | |
enableShareButton($('.twitter-share-button-placeholder')); | |
} | |
}); | |
function enableShareButton(elm) { | |
elm.addClass('twitter-share-button') | |
.removeClass('twitter-share-button-placeholder') | |
.attr('href', 'https://twitter.com/share') | |
.unbind('click'); | |
!function(d,s,id){ | |
var js, | |
fjs=d.getElementsByTagName(s)[0], | |
p=/^http:/.test(d.location)?'http':'https'; | |
if(!d.getElementById(id)){ | |
js=d.createElement(s); | |
js.id=id; | |
js.src=p+'://platform.twitter.com/widgets.js'; | |
fjs.parentNode.insertBefore(js,fjs); | |
} | |
}(document, 'script', 'twitter-wjs'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment