0

我正在使用 jquery Isotope 并有一系列使用以下布局的图块:

<div class="element tileG g"><div class=titlePE>
    <div class="nameP"></div>
    <div class="subDefn"></div></div>
    <div class="content"></div>
</div>

内容设置为高度:90px。我希望能够测试它是否溢出并设置一个视觉指示器,以便用户知道展开图块。我使用的概念是单击按钮类“字母”我简要设置内容高度:自动并测量其新高度。这是我的代码(不起作用:(

$(".letter").click(function () {
    $('.element').each(function(){
    h1 =  $(this).find('.content').outerHeight();
    $('.content').css( { 'height': 'auto' });
    h2 = $(this).find('.content').outerHeight();
    $('.content').css( { 'height': 90 });
    if ( h2 > h1 ) { $('.content').css( { 'background': 'white' }); }
        });
            });

所有的瓷砖最终都是白色的。

我非常愿意接受一个新概念或一些关于上述代码错误的建议。

4

0 回答 0