.toggle() 适用于 ACF 中继器中的所有内容
.toggle() applying to everything in ACF repeater
$( ".employee-big" ).click(function() {
$( ".info" ).toggle( "slow" );
});
//these are repeaters so class gets repeated
<div class="employee big">
<div class="info"></div>
</div>
所以我有 div,当您单击它时它会显示员工的信息,这些是 wordpress 中的高级自定义字段重复器,因此对添加的每个员工重复相同的 class。有没有一种方法可以让我只针对获得点击的员工,这样当您点击一个员工时,切换不会应用于每个员工?
试试这个
$( ".employee-big" ).click(function() {
$(this).find( ".info" ).toggle( "slow" );
});
$( ".employee-big" ).click(function() {
$( ".info" ).toggle( "slow" );
});
//these are repeaters so class gets repeated
<div class="employee big">
<div class="info"></div>
</div>
所以我有 div,当您单击它时它会显示员工的信息,这些是 wordpress 中的高级自定义字段重复器,因此对添加的每个员工重复相同的 class。有没有一种方法可以让我只针对获得点击的员工,这样当您点击一个员工时,切换不会应用于每个员工?
试试这个
$( ".employee-big" ).click(function() {
$(this).find( ".info" ).toggle( "slow" );
});