I am using turbo-rails to implement post's infinite scroll. This posts have images and I use vanilla js to provider a good visualization of images as showed bellow:
<%= link_to file, 'data-fslightbox': "gallery" do %>
<%= image_tag file, class: 'img-fluid', loading: 'lazy' %>
<% end %>
The gallery works well at the "first page", but the next pages, the "gallery" does not work.
Anyone may help me about it?