Reputation: 5271
When I onhover I can get the effect what I need, but when I move the mouse to "my list" a
tag, #bb
div disappeared. how could I make it stays there as I need to click it.
HTML:
<div id="aa">click</div>
<div id="bb"> <a href="">my list</a></div>
jQuery:
$('#bb').hide();
$('#aa').hover(function(){
$('#bb').slideToggle();
});
Online sample here - http://jsfiddle.net/9tjZK/
Upvotes: 1
Views: 338
Reputation: 6002
olo, you can try using on click event than hover, this gives you the desired results.
you can check here http://jsfiddle.net/9tjZK/8/
Upvotes: 0
Reputation: 14827
Change your HTML to this:
<div id="wrapper">
<div id="aa">click</div>
<div id="bb"> <a href="">my list</a></div>
</div>
and jQuery code:
$('#bb').hide();
$("#wrapper").hover(
function () {
$('#bb').stop(true, true).slideDown();
},
function () {
$('#bb').stop(true, true).fadeOut();
}
);
Demo: http://jsfiddle.net/9tjZK/9/
Upvotes: 1
Reputation: 68596
Working jsFiddle here - http://jsfiddle.net/9tjZK/7/.
HTML:
<div id="container">
<div id="aa">click</div>
<div id="bb"> <a href="">my list</a></div>
</div>
jQuery:
$('#bb').hide();
$('#aa').mouseenter(function(){
$('#bb').fadeIn();
});
$('#container').mouseleave(function(){
$('#bb').fadeOut();
});
Upvotes: 0