Reputation: 141
I've got this problem with some jQuery. I want to display this div when you hover over an element and hide it when you aren't on it.
$(function() {
$('#projects').hover(function() {
$('#projects .pane').show(200), $('#projects .pane').hide(200);
})
});
When you hover it disappears the same time.
Thanks :)
Upvotes: 0
Views: 100
Reputation: 7128
$(function() {
$('#projects').hover(function() {
$('#projects .pane').show(200)},
function() {$('#projects .pane').hide(200);}
)
});
Upvotes: 1
Reputation: 82893
You forgot the function(){ seperator, hence the current code is including hide and show in the mouse over event. Try this:
$(function() {
$('#projects').hover(function(){
$('#projects .pane').show(200)
}, function(){
$('#projects .pane').hide(200);
});
});
Upvotes: 3
Reputation: 382656
Your code should look like this:
$(function() {
$('#projects').hover(function() {
$('#projects .pane').show(200);
}, function(){
$('#projects .pane').hide(200);
});
});
The hover
expects two function parameters. One for when mouse is over and other one when mouse is away.
Upvotes: 1