【问题标题】:Is there a conflict with this code and FancyBox3?这段代码和FancyBox3有冲突吗?
【发布时间】:2019-02-23 00:51:15
【问题描述】:

谁能告诉我这段代码有什么问题?我最近开始使用它,但在 Fancybox 库的功能停止工作后不久就发现了。与整体元素相比,链接元素只是一条条。我不确定是不是这样。我知道我最近所做的编辑是将周围的行从 .row-fluid 修复为 .row ,因为这破坏了我的布局。下面是代码:

    <body id="portfolio"> 
     <div class="container-fluid" id="particles-js"></div>
      <%= render 'layouts/altmenu_gallery' %>
        <h1>Portfolio</h1>

        <div id="gallery" class="container-fluid">
          <% @photos.each_slice(4) do |group| %>
            <div class="row ">
              <% group.compact.each do |photo| %>
                  <div class= "col-md-3">
                    <a class="fancybox" data-fancybox="gallery" href="<%=image_path photo.file_url %>" data-caption="<%=  photo.description %>"> 
                      <%= image_tag photo.file_url, class:' img-fluid img-thumbnail'  if photo.file.present? %>
                     </a>
                  </div>
              <% end %>
            </div>
          <% end %>
          <br class="clear">
          </div>


        <%= link_to 'New Photo', new_photo_path %>
   </body>

【问题讨论】:

  • 你是如何实例化fancybox的?我猜你在页面加载时运行了一些 javascript
  • 抱歉刚刚回来,我在资产文件夹中。如果可以的话,我会用完整的页面代码更新。

标签: ruby-on-rails fancybox-3


【解决方案1】:

抱歉,如果没有看到实际的 html 代码,或者最好是现场演示,就无法判断。可能出现这个问题是因为您没有转义 photo.description 并且这会破坏 html 代码,但是,正如我所说,我不能确定。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2021-08-12
  • 2011-01-04
  • 2018-12-06
  • 1970-01-01
  • 2012-09-01
  • 1970-01-01
  • 2014-06-05
  • 1970-01-01
相关资源
最近更新 更多