Jump to content

AJAX or Lazy Loading


michelangelo
 Share

Recommended Posts

Hello there,

I am building my website, which has a dozen projects with 10 images each. Basically, I need a filtering system but built in the most efficient and user-friendly way. You can see below that the images flow sideways so being hidden, JS lazy loading was a good tool, but I just wanted to try AJAX. Is it fit for this purpose or it's more for dynamic content?
 

Screenshot 2019-11-02 at 19.00.39.png

Link to comment
Share on other sites

In this case I wouldn't want to have the overhead of having to set up an API endpoint and rendering AJAX-loaded content in JS, but use simple lazy loading. I.e. leave the src attribute of the images that are not initially visible out, and include a data-src attribute or similar instead, then dynamically programmatically replace the src attribute once the images get close to the viewport.

Or, you know, use native lazy loading which has landed in Chrome and is a progressive enhancement so you don't need any JS at all, but can be polyfilled as well if you want to. Has pretty good browser support out of the box as well.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...