LinkedIn Button is always showing, in my consideration, a weird attitude in comparison with other buttons.
The issue this time, is the delay in apparition, even after use of 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 wrapping div of social buttons.
CreateNewLikeButton()
,CreateNewTweetButton()
,CreateNewPlus1Button()
CreateNewLinkedinButton()
, andCreateNewSuButton()
are functions that are dynamically updating social buttons when loading another Wordpress post via Ajax.str
is the passed parameter and contains the ID of post.
Everthing is working ok, except for the LinkedIn button. For the sake of information, CreateNewLinkedinButton() code is:
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 is :
<div id="linkedin"><script type="IN/Share" data-url="<?php the_permalink();?>" data-counter="top"></script></div>
I have already posted about: Do not show social buttons (loaded via jquery) till they all are completely loaded and got a help which worked fine for all social buttons except LinkedIn one.
Thank you in advance for your valuable time