user357034
user357034

Reputation: 10981

Dynamically add addthis to certain part of the page with jQuery

I am trying to dynamically add the Addthis widget to a certain area of the page with jQuery. The following code works fine except in IE where it does not show at all.

jQuery(function(){
if (typeof global_Current_ProductCode != 'undefined'){
    jQuery.getScript('http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-xxxxxxxxxxx',function(){
        var add_this_html ='<div class="addthis_toolbox addthis_default_style " style="margin-top:20px">';
        add_this_html += '<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>';
        add_this_html += '<a class="addthis_button_tweet"></a>';        
        add_this_html += '<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>';
        add_this_html += '</div>';
        jQuery('.text.colors_text:eq(0)').closest('table').before(add_this_html);
        addthis.init();
        });
    }
});

This is all I see in IE with firebug lite.

<div class="addthis_toolbox addthis_default_style ">
    <a class="addthis_button_facebook_like" fb:like:layout="button_count"/>
    <a class="addthis_button_tweet"/>
    <a class="addthis_button_google_plusone" g:plusone:size="medium"/>
</div>

Anyone have any idea why it will not appear in IE?

Upvotes: 0

Views: 672

Answers (1)

Mark iv
Mark iv

Reputation: 21

Try the addthis.toolbox() method instead of addthis.init()

Upvotes: 2

Related Questions