• Resolved jerryskate

    (@jerryskate)


    Hi!

    I use infinite scroll on my site, and a script that replaces my iframe for videos. I need to re-fire the script after Infinite Scrolls load new posts, but unsure how. There is a function for tis, but can’t get it to work. Heres a paste bin on the code: https://pastebin.com/Yfq21w0C

    Any ideas?

Viewing 15 replies - 1 through 15 (of 23 total)
  • In your infiniteScroll script, after success, put your script that replaces my iframe for videos.

    Thread Starter jerryskate

    (@jerryskate)

    I use the the wp plugin for Infinite Scroll, but it has a callback window in setting. What part would that be? The first function of the code is supposed to be a function for callback, and from my understanding this is the function i nee dot place there. Just that anything I tried won’t work..

    I see it !

    I see it !

    Thread Starter jerryskate

    (@jerryskate)

    Yoo see what? It still don’t work for me.. The second part of posts that shows up when scrolling down is without the correct iframe.

    How do I pass additional arguments such as callbacks to the Infinite Scroll script?
    Source/
    https://github.com/paulirish/infinite-scroll/tree/master/wordpress-plugin
    how To pass additional arguments to the Infinite Scroll script, add the following code to either your theme’s functions.php or to a stand-alone plugin file.

    function my_infinite_scroll_options_filter( $options ) {
    $options[‘callback’] = ‘my_callback’;
    $options[‘another_parameter’] = ‘another_value’;
    return $options;
    }

    add_filter( ‘infinite_scroll_js_options’, ‘my_infinite_scroll_options_filter’ );

    Another exemple for callback your function whit FancyBox.
    Ex.
    function applyFancyBoxToImages(elements){
    $(elements).each(function(){
    $(this).find(‘img’).fancybox();
    });
    }

    $(elem).infinitescroll(options,applyFancyBoxToImages(arrayOfNewElems));

    Thread Starter jerryskate

    (@jerryskate)

    Hmm. Thats callback for the standalone script isn’t they? Wonder if they work for the plugin. How would I rewrite this ego wok with my function?

    Yes, what is your script that replaces my iframe for videos ?

    Thread Starter jerryskate

    (@jerryskate)

    Are you in infinite scroll Options this ligne Callback after item Selector ?

    Past this in Callback :

    if ( $(‘your-class’).length ) {
    wprssbind(); // your function
    }

    Thread Starter jerryskate

    (@jerryskate)

    Hi again, and thanks. Still not working. and yes, infinite scroll options after item selector, callback window.

    OK juste past it for test :
    jQuery(document).ready(function($){

    jQuery(document).removeClass(‘colorbox’);

    wprssbind();

    });

    What is your Url please for debug ?

    what is your url please for debug ?

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘how do I initiate this script (function) as a callback with infinite scroll?’ is closed to new replies.