【问题标题】:How to pass EJS variable to data-src of LightGallery如何将 EJS 变量传递给 LightGallery 的 data-src
【发布时间】:2020-06-06 03:00:40
【问题描述】:

我想在 nodeJS 中使用 LightGallery 设计图片库。当我静态传递图像名称(路径)时它工作正常,但现在我想传递 EJS 变量,该变量将包含文件夹中所有图像的名称,但它不起作用

这是代码

      <% images.forEach(function(image){ %>
       <% var imgpath = '/'+ new String(image) %> 
         <div class=" col-sm-6 col-lg-4">
           <div  zoom="false" data-download-url="false" data-sub-html="<h4>Fading Light</h4><p>Classic view </p>" data-src= <%= imgpath %> > //not Working Here tried Adding quotes still...
           <a href=""> 
           <img class="img-thumbnail img-responsive" src= "<%= imgpath %>" > 
           //This works fine here
           </a>
         </div>
      </div>

 <% }) %>

【问题讨论】:

    标签: javascript html jquery css ejs


    【解决方案1】:

    得到答案!这是一个引导错误,我使用了``` 这就是问题所在!

    【讨论】:

      猜你喜欢
      • 2016-03-04
      • 1970-01-01
      • 2014-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-26
      • 2018-11-14
      • 1970-01-01
      相关资源
      最近更新 更多