WordPress.org

Ready to get started?Download WordPress

Forums

Infinite scroll + addthis (7 posts)

  1. Eldiabel
    Member
    Posted 2 years ago #

    Hello I'm using infinite scroll plugin (which is pretty amazing) and addthis plugin for share buttons... After more content loads by infinite scroll, button's don't appear on loaded posts, could someone help me ? I think that key is in callback javascript, but I don't know how to write the code to do it for me. Thx for help.

  2. Aaron Jorbin
    Member
    Posted 2 years ago #

    In Settings > Infinte Scroll there is a box for javascript callbacks. If you add the following to calls, AddThis should get rendered correctly.

    addthis.toolbox('.addthis_toolbox');
    addthis.counter('.addthis_counter');

    If that doesn't work, what is your site's url? I'll need to take a look at your implementation to give you the correct code.

  3. Eldiabel
    Member
    Posted 2 years ago #

    I did:
    if (window.addthis){

    window.addthis.ost = 0;
    window.addthis.ready();
    }
    And it works without problems, but thanks alot.

  4. anagai
    Member
    Posted 1 year ago #

    This does not work in IE 7-8. Error generated when I do addthis.toolbox('.addthis_toolbox'); in the infinite-scroll callback func.

    The IE error:

    Message: Unknown runtime error
    Line: 2
    Char: 104650
    Code: 0
    URI: http://s7.addthis.com/static/r07/core012.js

    The addthis buttons are being added to all the new scolled images in all other browsers.

  5. anagai
    Member
    Posted 1 year ago #

    adding the addthis individual social buttons on every image is problematic. For every page infinite-scroll loads it loads about hundred javascript files to generate all those individual social like buttons. Really drags loading of the page. We are just going to have single addthis share button per image instead. Much less resource intensive and works in IE 7-8 mostly. IE 7 does not recognize the url passed through the addthis button. Just uses the gallery page the image is sitting in not the individual image link.

  6. evandroguedes
    Member
    Posted 1 year ago #

    Put this code into callbacks infinite scroll option:

    stButtons.makeButtons();

  7. syed tabrez
    Member
    Posted 1 year ago #

    Aaron Jorbin is right.That code will definitely work. I am using Infinite scroll masonry.I just added the lines posted by him and it worked.

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    function( newElements ) {
            // hide new items while they are loading
            var $newElems = $( newElements ).css({ opacity: 0 });
            // ensure that images load before adding to masonry layout
            $newElems.imagesLoaded(function(){
              // show elems now they're ready
              $newElems.animate({ opacity: 1 });
              $container.masonry( 'appended', $newElems, true );
              addthis.toolbox('.addthis_toolbox');
              addthis.counter('.addthis_counter');
              addthis.init();
            });
          });

    Thanks Aaron Jorbin.

Topic Closed

This topic has been closed to new replies.

About this Topic