简体   繁体   English

插件Addthis:打开addthis onclick

[英]Plugin Addthis: open addthis onclick

how can I launch a modal window addthis after a click on the button. 单击按钮后,如何启动模态窗口addthis。 I've tried: 我试过了:

 <script type="text/javascript">
        $('.share').live('click', function() {
        var addthis_config =
        {
            data_track_addressbar: true,
            services_compact: "email, facebook, twitter, google_plusone_share, gmail, pinterest"
        }
        addthis.button('.share', [addthis_config], [{}]);
        }); 
    </script>

In this way it works, just that I have to do 2 clicks to open the modal window. 通过这种方式,我只需要单击2来打开模式窗口即可。 Link in my template: 链接到我的模板中:

<a class="share">Share</a>

The code you're using will make the .share element a button, but not open it. 您正在使用的代码将使.share元素成为按钮,但不会打开它。 To open the AddThis modal window you need to fire a second click event using something like this: 要打开AddThis模态窗口,您需要使用类似以下的方法触发第二个单击事件:

$('.share').click();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM