I really have no idea why this isn't working, I've tried everything, by using .next(), .sibling(), .parent(), .children(). Non of them seemed to worked.
<html>
<head>
<script src="js/jQuery.js"></script>
<style> .child { display:none; } </style>
</head>
<body>
<div class='parent'> Parent 1 - <div class='child'>Child 1</div> </div>
<div class='parent'> Parent 2 - <div class='child'>Child 2</div> </div>
<div class='parent'> Parent 3 - <div class='child'>Child 3</div> </div>
<script type="text/javascript">
$( function()
{
// NON OF THESE WORK
$('.parent').hover(
function() { $(this).next('child').fadeIn('slow'); },
function() { $(this).next('child').fadeOut('slow'); }
);
$('.parent').hover(
function() { $(this).parent().next('child').fadeIn('slow'); },
function() { $(this).parent().next('child').fadeOut('slow'); }
);
$('.parent').hover(
function() { $(this).sibling('child').fadeIn('slow'); },
function() { $(this).sibling('child').fadeOut('slow'); }
);
$('.parent').hover(
function() { $(this).parent().sibling('child').fadeIn('slow'); },
function() { $(this).parent().sibling('child').fadeOut('slow'); }
);
$('.parent').hover(
function() { $(this).children('child').fadeIn('slow'); },
function() { $(this).children('child').fadeOut('slow'); }
);
$('.parent').hover(
function() { $(this).parent().children('child').fadeIn('slow'); },
function() { $(this).parent().children('child').fadeOut('slow'); }
);
} );
</script>
</body>
</html>
I know fadeIn automatically displays a display:none class, so probably that is not the problem.
Can anyone help me find what is missing here?
Thank you for your help
EDIT:
What does work is by just using the .css() or pure CSS parent:hover, but there is no animation which defeats the purpose of using jQuery
This post has been edited by ernestlwl: 21 April 2012 - 11:10 PM

New Topic/Question
Reply


MultiQuote


|