WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
Javascript to be called for Add to Any (Lockerz) plugin (5 posts)

  1. Art Webb
    Member
    Posted 2 years ago #

    WordPress version: 3.3.1
    Infinite Scroll version: 2.0b2.120111
    Theme: YooTheme Sparkz
    Plugin: Addtoany (Lockerz) Social Media Share
    JS Resources: http://share.lockerz.com/buttons/customize/asynchronous_loading or http://share.lockerz.com/buttons/customize
    http://static.addtoany.com/menu/page.js
    Test site: http://theboombaplive.com

    I'm attempting to call javascript so that my "share / email" button will load the 'AddtoAny (lockerz)' dropdown menu for new posts created by Infinite Scroll. I really didn't want to bother anyone and was sure to research entire forum before coming here. Sorry if I'm missing any information. The following below were the most helpful posts:

    http://wordpress.org/support/topic/infinite-scroll-vs-fb-like-and-g
    http://wordpress.org/support/topic/plugin-infinite-scroll-masonry-infinite-scroll-what-javascript-to-call

    Code:

    // A custom "onReady" function for Lockerz Share
    function my_addtoany_onready() {
        a2a_config.target = '.share-this';
        a2a.init('page');
    }
    
    // Setup Lockerz Share "onReady" callback
    var a2a_config = a2a_config || {};
    a2a_config.tracking_callback = {
        ready: my_addtoany_onready
    };
    // Additional a2a_config properties may go here
    
    // Load Lockerz Share script asynchronously
    (function(){
        var a = document.createElement('script');
        a.type = 'text/javascript';
        a.async = true;
        a.src = 'http://static.addtoany.com/menu/page.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(a, s);
    })();

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. Art Webb
    Member
    Posted 2 years ago #

    ps: thanks in advance :)

  3. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Someone asked recently for the regular addtoany script, this might work (put this in the javascript to be called after posts load box):

    if (window.addthis){
    
    window.addthis.ost = 0;
    window.addthis.ready();
    }

    EDIT: Ignore me... thats for the addthis plugin... I'll take a look tomorrow :)

  4. Art Webb
    Member
    Posted 2 years ago #

    No worries. Thanks for the quick response -- and I'm sure those seeking the "ShareThis" javascript call for Infinite-Scroll will find the above code useful.

  5. xyzeedesign
    Member
    Posted 1 year ago #

    Hi guys,

    I found this worked for me

    $(document).ready(function() {
    if (window.addthis){
    window.addthis = null;
    }
    $.getScript('https://s7.addthis.com/js/250/addthis_widget.js#async=1');
    if (window.addthis) {
    window.addthis.ost = 0;
    window.addthis.ready();
    }
    })

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic