tmort / Socialite

Other
1.68k stars 164 forks source link

Better support multiple buttons on a page #108

Closed arturi closed 8 years ago

arturi commented 8 years ago

Now if you try to use Socialite with Vkontakte, it will work only when loaded the first time — on the second load new Vkontakte buttons won’t appear (Facebook and Twitter work fine). But I wanted to call Socialite.load() every time an event if fired to load buttons for a specific post.

This fixed it for me and this is how I’m using it:

$('.js-open-like').click(function() {
      $(this).next('.js-like-share-popup').toggleClass('is-open');
      Socialite.load(
        $(this).next('.js-like-share-popup')[0]
      );
});

Provided there are multiple .js-open-like buttons and .js-like-share-popup containers on the page.

Also added support for data-height and data-pageUrl attributes.