Есть item, в нем content
и slide
. Как при нажатии на .more
в content
, с помощью jQuery, добавить класс в slide
?
//Не работает. Надо - при нажатии на 'more' в 's-services-content' добавлять класс в '.s-services-slide' и убирать при повторном нажатии.
$(".more").click(function() {
$(this).find('s-services-slide').toggleClass('s-services-slide-show', [1000])
});
<div class="col-md-7">
<div class="s-services-item" style="background-image: url(img/ourServices/1.jpg);">
<div class="s-services-content">
<div class="text">
<h3 class="h3">Designing is the cool love for.</h3>
<p>Our most popular service is our Virtual Receptionist. We know that sometimes it’s something and you middle most this job was posted less than five minutes ago, and we think it’s a good match for you. If you submit a proposal now, you’ll be one
of the first candidates. You may even catch the client while they’re still online.</p>
<span class="more">Know more <i class="fa fa-long-arrow-right"></i></span>
</div>
</div>
<div class="s-services-slide">
<div class="text">
<h3 class="h3">Designing is the cool love for.</h3>
<p>Our most popular service is our Virtual Receptionist. We know that sometimes it’s something and you middle most this job was posted less than five minutes ago, and we think it’s a good match for you. If you submit a proposal now, you’ll be one
of the first candidates. You may even catch the client while they’re still online.</p>
<span class="more">Know more <i class="fa fa-long-arrow-left"></i></span>
</div>
</div>
</div>
</div>
//Доработал, большое спасибо MedvedevDev
$(".more").click(function() {
$(this).closest('.s-services-content').siblings('.s-services-slide').addClass('s-services-slide-show');
$(this).closest('.s-services-slide').removeClass('s-services-slide-show');
});
.find('.s-services-slide')
сейчас же он ищет элементы<s-services-slide></s-services-slide>
<span class="more">
нет элементов с классомs-services-slide
.closest
вместо find