If you click the gear on the JS tab you can include jQuery, then review your selectors:
$('.sixteen columns responsive-footer mobile-show ul.menu > li > a')
Means all a that are direct childs of li, direct childs of ul.menu, descendants of mobile-show, descendants of responsive-footer, descendants of columns, descendants of .sixteen. This is not what you want since the sixteen columns responsive-footer mobile-show are classes on the same element. Use something like:
$('.responsive-footer ul.menu > li > a')
If you remove unnecessary classes from the html I can help you more, they are kinda slapping me in the face when trying to figure them out :P
Remove the display: none; from .sub-menu li and hide the submenus using jQuery instead. That way if a user doesn't have javascript enabled the whole menu is still accessable.
$(function() {
// hides all submenus
$('.sub-menu').hide();
var current = null;
$('.menu > li > a').click(function(e) {
if (current)
current.slideUp();
current = $(this).next('.sub-menu');
current.stop().slideDown();
e.preventDefault();
});
});
I would like the child pages (in white) to be hidden until the parent pages (in green) are clicked, and then only those child pages would be shown.
Here is what I have so far, but something isn't working right: http://codepen.io/anon/pen/FtrKI
Here is the thread where I created a similar nav, using the same code: http://css-tricks.com/forums/discussion/20608/mobile-navigation-dropdown#Item_17
Any ideas?
Thanks guys! I've been banging my head over this one for a bit. I'm far from a jQuery expert.
If you click the gear on the JS tab you can include jQuery, then review your selectors:
Means all a that are direct childs of li, direct childs of ul.menu, descendants of mobile-show, descendants of responsive-footer, descendants of columns, descendants of .sixteen. This is not what you want since the
sixteen columns responsive-footer mobile-showare classes on the same element. Use something like:If you remove unnecessary classes from the html I can help you more, they are kinda slapping me in the face when trying to figure them out :P
Gross. I didn't realize how much junk I left in that code. Here is a much cleaner version of the same code: http://codepen.io/anon/pen/FtrKI
Thanks for the help @CrocoDillon. I'm going to attempt what you said now, but I wanted to get the updated Pen posted ASAP.
Remove the
display: none;from.sub-menu liand hide the submenus using jQuery instead. That way if a user doesn't have javascript enabled the whole menu is still accessable.@CrocoDillon - Works like a charm! Thank you!
Working Pen here: http://codepen.io/JeremyMG/pen/vsCpI