Skip to content

Instantly share code, notes, and snippets.

@jde
Created January 22, 2015 19:30
Show Gist options
  • Save jde/5207ca123b8d2bd47fbb to your computer and use it in GitHub Desktop.
Save jde/5207ca123b8d2bd47fbb to your computer and use it in GitHub Desktop.
<!-- container element, a ul->li element structure will be injected into this by the nyt5 framework. Note the data-shares param that holds which share tools to bring in -->
<span aria-label="tools" role="group" class="share-container" data-shares="google|,facebook|,twitter|,linkedin|"></span>
<script>
// require the foundation
require(['foundation/main'], function () {
// require share-tools-container (should be in a nested require statement, not in same require as foundation)
require([
'jquery/nyt',
'shared/sharetools/views/share-tools-container'
], function ($, ShareToolsContainer) {
// selecte the container
var $container = this.$('.share-container'),
shareToolsContainer;
// create an instance of the object
shareToolsContainer = new ShareToolsContainer({
el: $container
});
// set the data attributes
shareToolsContainer.shareData.setDescription("The Description");
shareToolsContainer.shareData.setTitle("The Title");
shareToolsContainer.shareData.setUrl("the Url");
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment