动态创建的内容显示相同的标题/描述? [英] Dynamically created content shows the same title / description?

查看:70
本文介绍了动态创建的内容显示相同的标题/描述?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿那些伙计们,我很茫然,似乎无法解决这个问题。



基本上,我有一个图片库可以提供信息从Google Spreadsheets使用Sheetrock.js和Handlebars.js到模板。当您点击放大镜时,它会放大图像并显示标题和说明(由Google表格定义)。



我的问题是它显示相同所有图片的名称和信息。



这是一个例如。





以下是组成弹出模式的代码

 <   div     class   =  modal >  
< div class = overlay >
< a class = modal__close href = > < div class = fa fa-times modal__close > < / div > < / a >

< / div < span class =code-keyword>>
< div class = modal__contents modal - transition >

< ; img src < span class =code-keyword> = {{cells.ImageURL}} >
< div class = info-box >
< h3 class = car-title > {{cells.Title}} < / h3 >
< p class = car-info > {{cells.Description}} < / p >
< / div >
< / div >
< / div >





这是我的模板与Sheetrock / Handlebars JS的JS

< pre lang =Javascript> // 定义电子表格网址。
var mySpreadsheet = ' https://docs.google.com/spreadsheets/d / 1it6QkBRPDsIqYOtr_UbFFmHBEADVkKaKjdghLSX5d3E /编辑#GID = 0' ;

// 为团队RBI领导者编译Handlebars模板。
var RBITemplate = Handlebars.compile($(' #groups -rbi模板')HTML())。

// 加载前五名团队RBI领导者。
$ (' #image-grid')。sheetrock({
url:mySpreadsheet,
rowHandler:RBITemplate
});


});





似乎无法获得匹配的标题和说明up,任何帮助表示赞赏!

解决方案

' #团队RBI-模板')HTML());

// 加载前五名团队RBI领导者。


' #image-grid')。sheetrock({
url:mySpreadsheet,
rowHandler:RBITemplate
});


});





似乎无法获得匹配的标题和说明up,任何帮助表示赞赏!


Hey there guys, I'm at a loss and can't seem to figure this out.

Basically, I have an image gallery that pulls it's info from Google Spreadsheets using Sheetrock.js and Handlebars.js to template. When you click on the magnifying glass, it enlarged the image and displays the title and description (as defined by Google Sheets).

My problem is that it shows the same name and info for all the images.

Here is an example.


Here is the code that makes up the modal that pops up

<div class="modal">
                <div class="overlay">
                                <a class="modal__close" href="#"><div class="fa fa-times modal__close"></div></a>

                </div>
                <div class="modal__contents modal--transition">
                    
                    <img src="{{cells.ImageURL}}">
                    <div class="info-box">
                    <h3 class="car-title">{{cells.Title}}</h3>
                    <p class="car-info">{{cells.Description}}</p>    
                    </div>
                </div>
             </div>



Here is the JS for my template with Sheetrock / Handlebars JS

            // Define spreadsheet URL.
var mySpreadsheet = 'https://docs.google.com/spreadsheets/d/1it6QkBRPDsIqYOtr_UbFFmHBEADVkKaKjdghLSX5d3E/edit#gid=0';

// Compile Handlebars template for team RBI leaders.
var RBITemplate = Handlebars.compile($('#team-rbi-template').html());

// Load top five team RBI leaders.
$('#image-grid').sheetrock({
  url: mySpreadsheet,
  rowHandler: RBITemplate
});


});



Just can't seem to get the title and description matched up, any help is appreciated!

解决方案

('#team-rbi-template').html()); // Load top five team RBI leaders.


('#image-grid').sheetrock({ url: mySpreadsheet, rowHandler: RBITemplate }); });



Just can't seem to get the title and description matched up, any help is appreciated!


这篇关于动态创建的内容显示相同的标题/描述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆