Skip to content

Gallery image seems to first open in new tab, upon refresh it either works correctly or gives invalid source error #224

@programthis

Description

@programthis

As stated in the title, when I first click on the gallery image, it opens in a new tab. But when I refresh the page, it sometimes seems to behave correctly. But I've also received the invalid source error (the greyed out carousel with the "invalid source error text"). I've seen this happen in various browsers, albeit inconsistently. Any ideas would be very helpful.

fslightbox: version: 3.4.1

Here's an example of how I'm using fslightbox:

<% gallery_block.photo_blocks.each_with_index do |photo_block, index| %>
          <% if index < 4 %>
            <%= link_to content_tag(:div, '', style: %Q[background-image: url(#{rails_blob_url(photo_block.image)});]), rails_blob_url(photo_block.image), class: 'img', data: { fslightbox: "gallery_#{ gallery_block.id }", src: rails_blob_url(photo_block.image), "aria-label": "Image", turbolinks: false } %>
          <% elsif index == 4 %>
            <% if gallery_block.show_more? %>
              <%= link_to content_tag(:div, '', style: %Q[background-image: url(#{rails_blob_url(photo_block.image)});]), rails_blob_url(photo_block.image), class: 'img', "aria-label": "Image"  %>

              <div class='and-more'>
                <%= link_to "+#{gallery_block.photo_blocks.count - 5}", "aria-label": "Image", data: { fslightbox: "gallery_#{ gallery_block.id }", src: rails_blob_url(photo_block.image) } %>
              </div>

            <% else %>
              <%= link_to content_tag(:div, '', style: %Q[background-image: url(#{rails_blob_url(photo_block.image)});]), rails_blob_url(photo_block.image), class: 'img', data: { fslightbox: "gallery_#{ gallery_block.id }", src: rails_blob_url(photo_block.image), "aria-label": "Image", turbolinks: false }  %>
            <% end -%>

          <% else %>
            <%= link_to '', '', class: 'hide', "aria-label": "Image", data: { fslightbox: "gallery_#{ gallery_block.id }", src: rails_blob_url(photo_block.image), turbolinks: false }  %>
          <% end -%>
        <% end -%>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions