Support » Plugin: Lazy Loading Responsive Images » Make it work with AJAX requests

  • Resolved zitrusblau

    (@zitrusblau)


    Hey,

    nice to see lazysizes.js integrated as a plugin.

    I realized that content that gets added to DOM via AJAX calls won’t be parsed by your plugin, though (i.e. when adding content via masonry/isotope or similar scripts).

    this is due to the fact that is_admin() returns true for ajax, too.

    i added a modified version of your main plugin file to take this into account. would be nice if you integrated this mod in your next release, thanks!

    https://gist.github.com/zitrusblau/58124d4b2c56d06b070573a99f33b9ed

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Hey,

    thanks for the report and the code! I will look into this πŸ™‚

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    A few seconds ago I uploaded version 3.1.0, which includes your fix β€” would you give it a try and write me if all works fine (and of course also if something is not working πŸ™‚ )?

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    I will mark that as resolved for the moment – it worked in my tests.

    zitrusblau

    (@zitrusblau)

    yes, works. thanks for adding it to your plugin!

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Great to hear that, thanks again for developing the solution! πŸ™‚

    zitrusblau

    (@zitrusblau)

    don’t know if it’s related to the latest changes referring to admin request checks but now when adding a post thumbnail in backend, the image preview won’t be displayed initially in the corresponding metabox, the image seems to be parsed by your plugin now (i saw the class “lazyloaded” attached to the image tag”).
    after reloading (or saving the post), the image is then displayed though.

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Uh, will take a look at it, thanks for the report!

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Could you test if the changes from this branch fix the problem in the backend without breaking the frontend AJAX requests? That would be nice! πŸ™‚

    https://github.com/mtoensing/lazy-loading-responsive-images/tree/%236-fix-ajax-request-backend-issue

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    … did not do the trick completely, need to make additional changes…

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Now it should work, updated the branch.

    zitrusblau

    (@zitrusblau)

    yes, thank you! now it works in backend as well as on frontpage ajax requests.

    saw your code additions, seems to be more tricky than initially assumed.

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Great, thanks for testing! Will release a new version with the fix after getting feedback for another issue.

    saw your code additions, seems to be more tricky than initially assumed.

    Yes, I hope all AJAX request issues are fixed now πŸ™ˆ πŸ˜€

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.