WordPress.org

Ready to get started?Download WordPress

Forums

BJ Lazy Load
[resolved] BJ Lazy Load problem with AJAX and/or viewport resize (3 posts)

  1. kReEsTaL
    Member
    Posted 1 year ago #

    Hi!

    I use BJ Lazy Load and I activated the Infinite Scroll option. It's working great.

    However, there still are two problems which I cannot resolve:

    1. When I load some extra pictures with AJAX, I need to scroll the page to see the picture lazy load, even though these pictures are visible in the viewport. I don't know how to "force" BJ Lazy Load to execute in this case (I was trying something like helgatheviking but it simply won't work). In this topic, you suggested to manually trigger the scroll after the AJAX load, but I cannot get it to work without forcing the page to scroll… which is very unelegant (it'd look like a bug: why would a page automatically scroll?). I really need the advice of a JavaScript expert here :-)
    2. The same problem occurs when I resize the viewport: if some picture wasn't visible in the viewport 1 (i.e. mobile), and if I resize the viewport so that the picture get visible in viewport 2 (i.e. tablet), then BJ Lazy Load won't execute: I need to scroll the page again so that it does and loads the visible pictures on screen. Again, it looks quite buggy.

    I tried to fire BJ Lazy Load on resize, but it fails. Any idea please? Many thanks in advance :-)

    http://wordpress.org/extend/plugins/bj-lazy-load/

  2. Bjørn Johansen
    Member
    Plugin Author

    Posted 1 year ago #

    Again, thanks for the good feedback.

    Issue 1:
    You don't actually have to scroll, just trigger the scroll event. Like this:
    jQuery(document).trigger("scroll");

    Issue 2:
    I just released version 0.6.7 which should fix this bug.

  3. kReEsTaL
    Member
    Posted 1 year ago #

    Great, thank you! If I trigger the scroll in the AJAX load callback, it works perfectly.

    I was trying to trigger the scroll after the AJAX load function, and not on its complete, which was failing.

    Thank you so much for your help and update :-) Topic resolved, yay!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic