Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am loading easy social for teaser of some cintent type. When I am loading teaser list through ajax only facebook loads. Twitter and Google plus in not loading at all.
I have seen same issue was there in addthis widget and solution was to add following code after ajax request is completed-
$.getScript('http://s7.addthis.com/js/250/addthis_widget.js#pubid=xyz',
function(){
addthis.init(); //callback function for script loading
});
Comments
Comment #1
alexweber CreditAttribution: alexweber commentedI can't replicate this!
Could you please give step-by-step instructions to replicate this bug please so we can fix it?
Comment #2
jm.federico CreditAttribution: jm.federico commentedHi, you can see the problem by going to http://federicojm.com/en and opening one of the posts, they load via ajax.
Cheers
Comment #3
jm.federico CreditAttribution: jm.federico commentedOk, step by step the thing is:
Load a page with whatever content you have, but make sure it includes .
Have an ajax enabled link that load a node where the links are being printed
Click the link
The node will load but only the FB button will be renderes.
Solution is to run:
For Twitter
twttr.widgets.load();
For Google Plus
gapi.plusone.go();
After each ajax call
Haven't found a solution for LinkedIn
You can still look at http://federicojm.com/en which has issues with linked IN.
I'm current;y calling those two methods on my own modules on a Drupal.behavior.MODULE.attach(){}
Cheers
Comment #4
jm.federico CreditAttribution: jm.federico commentedThis is my current code:
Comment #5
jm.federico CreditAttribution: jm.federico commentedHA, been a bit active here, sorry for all the posts:
New discoveries:
To make G+ and Twitter work do this:
A note about LinkedIN:
When loaded via an AJAX request, the linked in plugin messes things up. I'm yet to discover why and how, but the symptom is that the Drupal.ajax method injects a lot of DIVs and the LinkedIN
tag too many times. I'm thinking it may be jQuery's fault, but no confirmation there yet. Im using ajax_command_replace() to create the AJAX response. CheersComment #6
alexweber CreditAttribution: alexweber commentedThanks jm.federico!
If you're willing to write a patch and make sure this doesn't break anything without ajax enabled we'll gladly commit it!
If not it might be a couple days because im on vacation :)
Comment #7
jm.federico CreditAttribution: jm.federico commented@alexweber
I'm on vacation too (so decided to implement the module on my personal blog).
I was on my way to create a patch but stopped. Module is a bit bigger than what I expected so will take my time to learn the code and implement it correctly.
Enjoy your holidays!
Cheers
Comment #7.0
jm.federico CreditAttribution: jm.federico commentedprivate pubid removed