Answer the question
In order to leave comments, you need to log in
Selector data attribute?
There are n-th number of such blocks, at least 20 pieces, and it is not correct to describe hover for each separately,
the question is the following. How can I show the corresponding main_calendar when hovering over month_block ?
<div class="month_block" data-idboard="id_1"> </div>
<div class="main_calendar" data-idboard="id_1"></div>
<div class="month_block" data-idboard="id_2"> </div>
<div class="main_calendar" data-idboard="id_2"></div>
<div class="month_block" data-idboard="id_3"> </div>
<div class="main_calendar" data-idboard="id_3"></div>
Answer the question
In order to leave comments, you need to log in
jsfiddle.net/u6wyycqg
$('.month_block').hover(function() {
var idboard = $(this).attr('data-idboard');
$('.main_calendar[data-idboard="' + idboard +'"]').slideToggle(200);
});
css
.month_block:hover + .main_calendar,
.main_calendar:hover {
display: block;
}
$('.main_calendar').hover(function() {
var idboard = $(this).data('idboard');
$('[data-idboard="' + idboard + '"]').slideToggle(200);
});
$('.month_block').mouseover(function(){
$(this).children().show()
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question