谁能帮帮我,我不明白错误在哪里。
这是我的 jQuery:
function altezzadotgrey(){
$('.views-field-title').each(function(){
var aaltezzadotgrey = $(this).outerHeight();
if ($(this).outerHeight() > 40) {
$(this).css("margin-top", "-45px");
}
});
}
这是我的 HTML:
<div class="views-row">
<div class="views-field-title">
<span class="field-content"><a href="">a</a></span>
</div>
</div>
<div class="views-row">
<div class="views-field-title">
<span class="field-content"><a href="">b</a></span>
</div>
</div>
<div class="views-row">
<div class="views-field-title">
<span class="field-content"><a href="">c</a></span>
</div>
</div>
<div class="views-row">
<div class="views-field-title">
<span class="field-content"><a href="">d</a></span>
</div>
</div>
我认为可能有问题each()
。