I have the following markup:
<!-- first marker -->
<div class="marker"></div>
<div class="tooltip">
<p>My tooltip content"</p>
</div>
<!-- second marker -->
<div class="marker"></div>
<div class="tooltip">
<p>My tooltip content"</p>
</div>
<!-- repeating..... -->
and the following jQuery javascript:
$(document).ready(function() {
$(".marker").hover(function(event){
$('.tooltip').hide();
$(this).next('.tooltip').slideDown('fast');
});
});
How can I modify this script so that on hover all other open div.tooltips hide except for the next one? Currently it tries to hide all.
You can use the
notfunction to omit a particular elementEDIT
Also, you’ll likely want to also pass a second function to
hoverso that things clean up when the hover ends: