I am working on a website and I have css animations for dropdowns but I want them to show up on click instead of on hover on the sub menu and cant seem to figure it out here is the code I am currently working with Sorry about all the PHP mixed in I copied it straight from the source. http://codepen.io/anon/pen/PwrNaZ
$( "#horiz-menu ul li > ul" ).click(function()
I Dont know jQuery very well but this is what I have so far.
You can do something like this using JQuery:
JQuery
$( "#horiz-menu a" ).click(function(e){
$(this).next('ul').toggleClass('active');
});
CSS
#horiz-menu ul.active {
opacity: 1;
visibility: visible;
margin: 0;
}
Heres a fiddle.
Try this:
$( "#horiz-menu ul li > ul" ).click(function(){
$( "#horiz-menu li" ).toggle( "slow" );
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.