次のコードがあります。どのようにしてコードを編集して、3番目の料金プランが常に青色に強調表示されるようにすることができますか?そして、別のテーブルをクリックすると、前のテーブル(3番目も含む)がハイライトされますか?前もって感謝します!1つの列を常にハイライト表示する方法
$('.pricing-customer').on('click', function(){
$(this).toggleClass('active');
$(this).siblings().removeClass('active');
});
.pricing-customer {
background: #fff;
min-height: 250px;
cursor: pointer;
transition: all .3s ease-in-out;
margin-bottom: 20px;
padding: 10px 0px 25px 0px;
}
p.pricing-number {
font-size: 52px;
margin-bottom: 10px;
margin-top: 20px;
color: #fead0d;
}
p.pricing-monthes {
color: #5e6977;
font-size: 14px;
line-height: 21px;
padding-bottom: 20px;
border-bottom: 1px solid #e1e8ee;
}
p.emails {
color: #444;
font-size: 16px;
line-height: 21px;
}
.pricing-customer:hover, .pricing-customer.active {
background-color: #333;
}
.pricing-customer:hover p , .pricing-customer.active p{
color: #fff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="pricing-customer col-sm-12 col-sm-3 text-center">
<h3><?php echo $t_title; ?></h3>
<p class="pricing-number">$ 70</p>
<br>
<p class="pricing-monthes">per week/month</p>
<p class="pricing-emails">100 000 emails</p>
</div>
<div class="pricing-customer col-sm-12 col-sm-3 text-center">
<h3><?php echo $t_title; ?></h3>
<p class="pricing-number">$ 70</p>
<br>
<p class="pricing-monthes">per week/month</p>
<p class="pricing-emails">100 000 emails</p>
</div>
<div class="pricing-customer col-sm-12 col-sm-3 text-center">
<h3><?php echo $t_title; ?></h3>
<p class="pricing-number">$ 70</p>
<br>
<p class="pricing-monthes">per week/month</p>
<p class="pricing-emails">100 000 emails</p>
</div>
素晴らしい!それは私のために完璧に動作します。どうもありがとうございます! – Morgari
@モルガリそれは私の喜びです! –
これはうまくいかない - 3番目の列を選択して別の列を選択すると、3番目の列から青いハイライトが消えます( 'default'クラスを削除しますが、再度追加しないため) – Beno