1

This menu works well on desktop but when I switch to mobile, I would like the menu to slideUp when the ul is clicked. So far, the menu slides up when a user clicks on the top / main menu. It is fine, but I'd like to have a better user experience by sliding / fading the sub menus.

2
  • Any solutions? The desktop version should not be toggled. Commented Sep 25, 2015 at 8:55
  • jsfiddle.net/telosantos/7xtx6061 Commented Sep 25, 2015 at 9:02

1 Answer 1

1

I don't know if you needed that other jQuery, but I just added the html into the doc and replaced your javascript with this:

$('#menu-button').on("click", function () {
    $('#cssmenu ul').slideToggle();
});

Taking advantage of jQuery's slideToggle() functionality.

Here's the fiddle: http://jsfiddle.net/16cq72ms/3/

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks @pgruber I had tried the slideToggle function but I would like to do it on the parent and ul li menus. I would also like to slide the ul li and return to the main menu after clicking.
@telo78 So clicking on the dropdown would also slide the element up? Check out my updated fiddle and let me know if I'm on the right track.
damn, that was easy. i was using slideToggle on both selectors. thanks so much! i will update my code accordingly. :)
Glad it worked! I actually just cleaned it up so it should be even cleaner now.
i'll check the desktop version. it shouldn't toggle tho. but yeah works nice and simple.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.