The LinkedIn Button always shows, in my opinion, a strange attitude compared to other buttons.
The problem this time is to delay the appearance, even after using the done () function:
function CreateNewsocial(str) { $(".dd_outer").fadeOut("slow"); CreateNewLikeButton(str); $.when(CreateNewTweetButton(str),CreateNewPlus1Button(str),CreateNewLinkedinButton(str),CreateNewSuButton(str)).done(function(){ $(".dd_outer").fadeIn('slow'); }); }
Where:
- dd_outer is the stroke of the div of social buttons.
CreateNewLikeButton()
, CreateNewTweetButton()
, CreateNewPlus1Button()
CreateNewLinkedinButton()
and CreateNewSuButton()
are functions that dynamically update social buttons when loading another Wordpress message via Ajax. str
is the passed parameter and contains the message identifier.
Everthing works fine except for the LinkedIn button. For information, the code CreateNewLinkedinButton ():
function CreateNewLinkedinButton(str) { var elem3 = $(document.createElement("script")); elem3.attr("type","IN/Share"); elem3.attr("data-url","http://website/Arra2issia/"+str+"/"); elem3.attr("data-counter", "top"); $("#linkedin").empty().append(elem3); return $.getScript("http://platform.linkedin.com/in.js?async=true", function() { IN.init(); }); }
and HTML:
<div id="linkedin"><script type="IN/Share" data-url="<?php the_permalink();?>" data-counter="top"></script></div>
I already wrote about: Do not show social buttons (downloaded via jquery) until they are fully loaded , and got help that worked great for all social buttons except LinkedIn.
Thank you in advance for your precious time.
source share