Home › Forums › JavaScript › jQuery SlideUp / SlideDown Navigation Menu Drop-Down
- This topic is empty.
-
AuthorPosts
-
July 25, 2013 at 9:14 am #144579
rpotterjr
ParticipantI need some help with making a slideDown / slideUp drop-down navigation menu…
What I have so far is here: http://codepen.io/rpotterjr/pen/fGLen
I am trying to make the drop-down in the navigation silde down on mouseover/mouseenter and slide back up on mouseout/mouseleave, or the hover event, but to my knowledge the hover event isn’t compatible in all browsers…
The ‘Portfolio’ link is all I need it for right now. The drop-down is functional, but…
I have tried this a few different ways and it is not working at all… The closest I got it would slide down, but stayed in a constant loop of sliding up and down once I stopped hovering over the ‘Portfolio’ link.
*I had this as a post before, but for some reason with the new changes to CSS-Tricks, it’s not letting me do anything with my previous post. Hopefully this works..
July 25, 2013 at 9:23 am #144581TheDoc
MemberI’ve got with the
mouseenter
andmouseleave
events here just because I’m used to doing that with Backbone: http://codepen.io/ggilmore/pen/982076b8dd766734e613f4eea744d70bI also remove some CSS that would override everything. Specifically, I removed this:
li.navDirectory:hover ul { display: block; }
And here’s the modified jQuery:
$(".navDirectory").mouseenter( function () { $(this).find(".sub-nav").slideDown(1000, "easeOutElastic"); }); $(".navDirectory").mouseleave( function () { $(this).find(".sub-nav").slideUp(500); });
July 25, 2013 at 11:16 am #144586Paulie_D
Member>I’ve got with the mouseenter and mouseleave events here just because I’m used to doing that with Backbone:
…and Jquery have just deprecated hover I think.
July 26, 2013 at 7:53 am #144703rpotterjr
ParticipantYeah I don’t use hover, because for it to work properly you have to use the hover.js library file, which is just another load on the system… Not needed…
July 26, 2013 at 8:02 am #144716rpotterjr
ParticipantSo my next question is how would you add a delay to this?
July 26, 2013 at 9:52 am #144728TheDoc
MemberWhat type of delay? When would the delay occur?
July 27, 2013 at 4:19 am #144804rpotterjr
ParticipantA delay when hovering, before the action takes place, to prevent unwanted effects…
July 27, 2013 at 4:44 am #144806rpotterjr
ParticipantNevermind. I wasn’t thinking… I didn’t want a delay. I realized what was missing, the .stop()… lol
July 27, 2013 at 4:46 am #144807rpotterjr
Participant -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.