michelangelo Posted November 2, 2019 Share Posted November 2, 2019 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? Link to comment Share on other sites More sharing options...
MoritzLost Posted November 3, 2019 Share Posted November 3, 2019 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 More sharing options...
michelangelo Posted November 4, 2019 Author Share Posted November 4, 2019 Hi @MoritzLost thank for your reply. That's exactly what I needed. The native lazy loading is new to me. I will definitely use that and leave AJAX for another project. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now