Hi. I have some rotating images with hidden captions that I'd like to expose with jQuery when someone hovers. Each image + caption is like this:
<img src="images/picture.jpg" id="feature-1-image" />
<p id="feature-1-caption" class="feature_caption">1: Here is the caption</p>
The caption is set to display: none; and placed on top of the image with top: -75px. The jQuery for the interaction is so:
$("img[id*=feature-]").hover(function(){
var feature_id = $(this).attr("id").split("-");
$('p[id=feature-' + feature_id[1] + '-caption]').addClass("showCaption");
},
function(){
var feature_id = $(this).attr("id").split("-");
$('p[id=feature-' + feature_id[1] + '-caption]').removeClass("showCaption");
});
It works fine, except, if you mouse over the caption itself, it flickers because the hover effect on the img is coming into play (i.e., the caption is on top of the image, so it fires for both hover and unhover, thus flickering).
I've tried a bunch of things, but not working. Any ideas on stopping the hover off event from firing if I'm on the caption text? Thanks.