Carla Lo Monte
Carla Lo Monte

Reputation: 85

Plugin Addthis: open addthis onclick

how can I launch a modal window addthis after a click on the button. I've tried:

 <script type="text/javascript">
        $('.share').live('click', function() {
        var addthis_config =
        {
            data_track_addressbar: true,
            services_compact: "email, facebook, twitter, google_plusone_share, gmail, pinterest"
        }
        addthis.button('.share', [addthis_config], [{}]);
        }); 
    </script>

In this way it works, just that I have to do 2 clicks to open the modal window. Link in my template:

<a class="share">Share</a>

Upvotes: 1

Views: 2539

Answers (1)

Paul
Paul

Reputation: 354

The code you're using will make the .share element a button, but not open it. To open the AddThis modal window you need to fire a second click event using something like this:

$('.share').click();

Upvotes: 1

Related Questions