【发布时间】:2015-12-02 06:09:21
【问题描述】:
我在含有同位素的列中有流体成分:
<template name="iso">
<div class="{{anchor}}">
<img src="{{image}}"/>
</div>
</template>
我填写了模板,当anchor = taller 时,我需要宽度= 25% 并且高度相同*2。正方形是 25% 和相同的高度,宽是 50% 和高度是 /2。
在js中:
template.iso.onRendered= function(){
$('.square').heigth() = $('.square').width
$('.toller').heigth() = $('.square').width * 2
$('.widen').heigth() = $('.square').width
};
但是,onRendered 在{{#each}} 的渲染之前运行,我拥有所有的 div,但高度没有改变。
有什么解决办法吗? (对不起我的英文写得不好)
【问题讨论】:
-
可能只是拼写错误;你有“heigth”,应该是“height” 是的,英语是一种疯狂的语言,但是这个词发音为“hite”。
-
首先你写了
$('.square').heigth()..更正它为$('.square').height() -
你好希望能帮到你,你试试添加CSS,例如:.square { height: auto; } 并且永远改变内容,这个调整
标签: jquery meteor jquery-isotope