- This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › jsFiddle – Help with jQuery simple drop down.
Can someone please take a look at this and help me where I am going wrong I am so rubbish with jQuery!
Many Thanks.
Basically, I hide the sub_menu, then added a hover event on the dropdown which fades in the sub_menu on mouseover and fades the sub_menu out when the mouse leaves. If you need more of an explanation, just ask :)
$("ul.sub_menu").fadeOut();
$('ul.dropdown').hover(function(){
$("ul.sub_menu").stop().fadeIn();
},function(){
$("ul.sub_menu").stop().fadeOut();
});
I have tried your code but can’t see it working.
Immediately on page load the menu appears then fades away but when I hover it doesn’t reappear.
This is crazy works perfectly in the jsFiddle but not on my local server. Must be something conflicting.
You should add this to your page:
(remember jsfiddle does the script tag and the on dom load for you)
Excellent works a treat mate.
Is there a better way to write this so when the page loads I don’t see the menu fade out?
Yeah there is: