-
-
Save Vlasterx/a5d077ee99b452f531c0 to your computer and use it in GitHub Desktop.
Google+ follow in dropdown menu
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
var $ = jQuery; | |
var gapi; | |
var googlePlusAdded = false; | |
var gplusoneLoaded = false; | |
var gplusClass = ".button__googlePlus"; // Class where you want to insert G+ button | |
var gplusPage = "http://your_google_plus_page"; | |
// Add Google+ on menu hover | |
$('#menu').hover(function() { // ID or Class of your menu hover | |
if (!googlePlusAdded) { | |
$(gplusClass).append('<div class="g-follow" data-annotation="bubble" data-height="20" data-width="120" data-href="'+ gplusPage + '" data-rel="publisher"></div>'); | |
googlePlusAdded = true; | |
if(!gplusoneLoaded){ | |
gplusoneLoaded = true; | |
$.getScript("//apis.google.com/js/platform.js"); | |
}else{ | |
if(gapi){ // IE7 can't handle it | |
gapi.plusone.go(); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment