weixin_33695082 2014-08-02 00:31 采纳率: 0%
浏览 37

Ajax之后重新加载AddToAny

I have a website where I am switching from addThis to addToAny for social sharing buttons. The problem is that the share buttons are contained in content that is loaded dynamically with jquery Waypoints infinite scroll feature (which uses Ajax). When the page first loads (so no Ajax called yet) everything works great, but when a user scrolls and more content is added that contain the share buttons, the new buttons don't work in that they don't show the share options on hover or click.

There are supposedly fixes for this if using templates from the likes of Drupal or Wordpress, but my site is not built using any of these templates. This was also a known issue with addThis, and to get around the problem you simply need to add 'addthis.toolbox('.addthis_toolbox')' into the success portion of the ajax call and things would work.

I haven't had any success getting addToAny to work after ajax returns. They have something that looked promising: a2a.init('page'), but that doesn't work. Has anyone had this problem and have any suggestions on how to fix it? Thanks!

  • 写回答

2条回答 默认 最新

  • weixin_33704591 2017-07-15 09:02
    关注

    If there so many share button on one page you can call this after ajax success:

    $(".a2a_dd").each(function() {
        a2a.init('page');
    });
    

    Or if there only one share button, you can use this after ajax success:

    a2a.init('page');
    

    If want to know more details go through this document

    评论

报告相同问题?