これを試してみてください。役立つかもしれません:
HTML:
<img class="image" src="" alt="TestImage"></img><a id="link">This is the link content</a>
CSS:
#link {
display: none;
}
脚本:
$(".image").hover(function(e) {
e.preventDefault();
$(this).fadeOut('slow', function(e) {
$('#link').fadeIn('slow');
});
});
$("#link").mouseout(function(e) {
e.preventDefault();
$(this).fadeOut('slow', function(e) {
$(".image").fadeIn('slow');
});
});
$( document ).ready(function() {
$(".image")[0].hover();
});
フィドル
更新されたスクリプト:
$(".image").hover(function(e) {
e.preventDefault();
$(this).stop().fadeOut('slow', function(e) {
$('#link').stop().fadeIn('slow');
});
});
$("#link, .image").mouseout(function(e) {
e.preventDefault();
if($(this).is("img"))
{
$(".image").stop().fadeOut('slow', function(e) {
$('#link').stop().fadeOut('slow', function(e) {
$(".image").stop().fadeIn('slow');
});
});
}
else
{
$('#link').stop().fadeOut('slow', function(e) {
$(".image").stop().fadeIn('slow');
});
}
});
$( document ).ready(function() {
$(".image")[0].hover();
});
更新されたフィドル