Customize Buttons

Multiple Buttons - Customize

Use the following code as a template for customizing multiple sharing buttons using AddToAny's JavaScript menu API.

<a class="a2a_dd" href="http://www.addtoany.com/share_save">Share Page 1</a>

<script type="text/javascript">
a2a_config = {
    linkname: 'Example Page 1',
    linkurl: 'http://www.example.com/page_1.html'
};
</script>

<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

|

<a class="a2a_dd" href="http://www.addtoany.com/share_save">Share Page 2</a>

<script type="text/javascript">
a2a_config.linkname = 'Example Page 2';
a2a_config.linkurl = 'http://www.example.com/page_2.html';
a2a.init('page');
</script>

|

<a class="a2a_dd" href="http://www.addtoany.com/share_save">Share Page 3</a>

<script type="text/javascript">
a2a_config.linkname = 'Example Page 3';
a2a_config.linkurl = 'http://www.example.com/page_3.html';
a2a.init('page');
</script>
Share Page 1 | Share Page 2 | Share Page 3

Details

<a class="a2a_dd" href="http://www.addtoany.com/share_save">Share Page 1</a>

<script type="text/javascript">
a2a_config = {
    linkname: 'Example Page 1',
    linkurl: 'http://www.example.com/page_1.html'
};
</script>

For the first button, the a2a_config object "shorthand notation" can be used as seen above. The shorthand can be used only once on a page.


<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

This calls the required external script and also initiates the menu on the first AddToAny button. (To initiate on subsequent buttons, you can use a2a_init('page') instead, as seen below.)


<a class="a2a_dd" href="http://www.addtoany.com/share_save">Share Page 2</a>

<script type="text/javascript">
a2a_config.linkname = 'Example Page 2';
a2a_config.linkurl = 'http://www.example.com/page_2.html';
a2a.init('page');
</script>

For every additional button, properties of the a2a_config object need to be defined individually, taking the form a2a_config.property = value. The a2a_config object shorthand cannot be reused.

The call to a2a.init('page') initiates the button's menu. After the external script (http://static.addtoany.com/menu/page.js) has been called once, a2a.init('page') can be used in lieu of another call to the external JavaScript.


<a class="a2a_dd" href="http://www.addtoany.com/share_save">Share Page 3</a>

<script type="text/javascript">
a2a_config.linkname = 'Example Page 3';
a2a_config.linkurl = 'http://www.example.com/page_3.html';
a2a.init('page');
</script>

Again, properties of a2a_config need to be defined individually, and a2a.init('page') can be used to initiate the button's menu.