jquery 'this' confusion
Posted
by Elliott
on Stack Overflow
See other posts from Stack Overflow
or by Elliott
Published on 2010-03-24T22:01:06Z
Indexed on
2010/03/24
22:03 UTC
Read the original article
Hit count: 366
jQuery
Hi I have the code below, once the first (only) item in the menu is hovered over, the subtext should appear. I have used 'this' as I thought it should find the class with the "li" and then slideDown. This doesnt seem to work, although 'this' works for when you remove the hover, as it slides up (top part not the subtext).
<body>
<script type="text/javascript">
$(document).ready(function()
{
$('li').hover(function()
{
$(this).stop(true, true).slideDown();
$(this).slideDown("slow");
},
function ()
{
$(this).slideUp("fast");
}
);
});
</script>
<ul>
<li class="hover">
<p><a href="#">Hover</a></p>
<p class="subtext">Show More</p>
</li>
</ul>
Any advice?
Thanks
© Stack Overflow or respective owner