From a quick look, the only problem I see is that <span> is not the right element to use here. It's what's known as an inline element—meaning that it belongs inside another block-level element like a <p>. HTML4 and under does not allow an inline element to wrap around a block element like a div.
In this instance, you don't need the extra element anyhow. You can just do this:
HTML
Code:
<div class="galleryphoto">
<img src="gallery/turtle-bite.jpg" width="400" height="258" alt="A turtle swims..."/>
<p>This turtle was spotted swimming around the Great Barrier Reef ...</p>
</div>
and then the JS can be a tad simpler:
jQuery
Code:
$(document).ready(function(){
// Making the gallery captions appear on hover
$(".galleryphoto p").hide();
$(".galleryphoto").each(function(){
$(this).hover(function(){
$(this).find("p").slideDown('medium');
},function(){
$(this).find("p").slideUp('medium');
});
});
});
Bookmarks