Created
October 14, 2011 20:31
-
-
Save b20n/1288249 to your computer and use it in GitHub Desktop.
Dynamically drawing superbars in arbitrary elements...
This file contains 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 drawShare = function (element, config) { | |
if (meteor && !meteor.missing(meteor.tracking.settings.cookie_name)) { | |
var bar_id = meteor.random_id(4); | |
config.node = document.createElement('div'); | |
config.node.id = bar_id; | |
config.node.className = "meteor_share_" + config.id; | |
config.node.style.position = 'relative'; | |
element.appendChild(config.node); | |
meteor.sharing.superbar.configure( | |
config, bar_id, function (json) { | |
meteor.sharing.superbar.reinit(json); | |
}); | |
} else { | |
// Recurse until track() has been called | |
setTimeout(function() { drawShare(element, config); }, 500); | |
} | |
}; | |
$(document).ready(function() { | |
drawShare(document.getElementById("qwer"), {"id": "foo"}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment