添加它不加载ajax内容

添加它不加载ajax内容

本文介绍了添加它不加载ajax内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在动态加载的内容上加载addthis按钮,但即使加载了脚本,也不会出现此工具栏。

I am trying to load addthis button on dynamically loaded content but even though the script is loaded addthis toolbar doesnt appear.

jQuery(".somediv").html(response); // dynamically loaded content
jQuery.getScript("//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53a011f32e6cd338")
    .done(function () {
        addthis.init();
        addthis.toolbox('.addthis_sharing_toolbox');
    })

以下是html内容

<div class="addthis_sharing_toolbox"></div>

请帮忙。

推荐答案

@amit我遇到了和你一样的问题。经过一些研究,我找到了这个问题的根源。

@amit I was facing the same problem as you. After some research, I rooted the source of this problem.

如果你通过仪表板添加了你的addthis按钮,有一些快捷方式的html / js代码可以添加到你的网站很快:

If you added your addthis button through the dashboard, there is some shortcut html/js codes to add them in your site very quickly:

<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_sharing_toolbox"></div>

但正式方式为表示将按钮添加到您的网站就像:

But the formal way as the addthis api doc states to add the buttons to you site is like:

<div class="addthis_toolbox" data-url="domain.com" data-title="title">
    <a class="addthis_button_facebook" style="cursor:pointer"></a>
    <a class="addthis_button_twitter" style="cursor:pointer"></a>
    <a class="addthis_button_email" style="cursor:pointer"></a>
</div>

因此,如果你在addthis_sharing_toolbox类的div框中添加以下行,它将最终工作。

So, if you add the following lines inside your div box of class 'addthis_sharing_toolbox', it will finally work.

<a class="addthis_button_facebook" style="cursor:pointer"></a>
<a class="addthis_button_twitter" style="cursor:pointer"></a>
<a class="addthis_button_email" style="cursor:pointer"></a>

这篇关于添加它不加载ajax内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:37