Question

I have asked this in the Addthis Support already but I haven't been given an answer there (has their forum been removed?!). So I figured I'd try here.

Here's what I want to do:

I have a couple of posts and each has it's own share button. The share button doesn't have any code, it's just an image. Upon clicking the share button, it calls a javascript function that loads this Addthis Box (http://i.imgur.com/LEOvKHQ.png) with the corresponding title and url of the shared post.

Seems quite easy, however, I cannot figure out how to call the Addthis Share Box. Maybe you do? You can see the box I want in action if you open http://www.addthis.com/ and click on the Addthis button on the left.

Was it helpful?

Solution

Alright everyone, I have solved it with a workaround. However, I am still looking for an actual solution. If you know the answer to my problem, please respond!

Now here's my code:

CSS:

#hidden{
    display: none;
    width: 1px;
    height: 1px;
    visibility: hidden;
}

HMTL:

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
<div id="hidden">
    <div id="share-helper"></div>
</div>

JavaScript:

function Share(id){
    addthis.button("#share-helper", {}, {url: "http://example.org", title: "Example Title"});
    $('#share-helper').trigger('click');
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top