kni-labs/rrssb

Buttons on ajax content

xtianus opened this issue · 3 comments

I'd like to show the share buttons on an ajax-loaded modal.
The modal is of course loaded after rrssb has been initialized on the main page, so the buttons don't behave well. I tried calling rrssbInit() in the ajax modal but it's not enough. This is the result:

image

dbox commented

Can you provide a demo / minimal working example?

Can't give you a demo right now buy I can tell you what I did to make it work:

  • removed "rrssbInit();" from end of "$(document).ready(function(){"
  • changed "$(document).ready(function(){" into "var documentReady = function() {"
  • added "documentReady();" just after "var rrssbInit = function() {"

Now I can call "rrssbInit();" whenever I need to initialize the buttons. For example after a bootstrap modal has opened:

                $('#ajaxModal').on('shown.bs.modal', function (e) {
                    rrssbInit();
                });
dbox commented

Let me know if you can post a demo and we'll reopen.