Thu, 2016-05-26 17:17
I am trying to change my vertical drop down menu to OnClick instead of mouse hover, but I can't find what to change. Here is my code:
<style type="text/css"> * { margin: 0px; padding: 0px; } nav { font-family: Helvetica, Arial, "Lucida Grande", sans-serif; line-height: 1.5; margin: 50px auto; /*for display only*/ width: 150px; -webkit-box-shadow: 2px 2px 5px rgba(0,0,0,0.2); -moz-box-shadow: 2px 2px 5px rgba(0,0,0,0.2); box-shadow: 2px 2px 5px rgba(0,0,0,0.2); } .menu-item { background: #fff; width: 150px; } /*Menu Header Styles*/ .menu-item h4 { color: #fff; font-size: 15px; font-weight: 500; padding: 7px 12px; background: #a90329; }.menu-item h4 a { color: white; display: block; text-decoration: none; width: 250px; } /*Menu Header Styles*/ .menu-item h4 { border-bottom: 1px solid rgba(0,0,0,0.3); border-top: 1px solid rgba(255,255,255,0.2); color: #fff; font-size: 15px; font-weight: 500; padding: 7px 12px; /*Gradient*/ background: #a90329; /* Old browsers */ background: -moz-linear-gradient(top, #A90303 0%, #900202 44%, #5F0000 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#A90303), color-stop(44%,#900202), color-stop(100%,#5F0000)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #A90303 0%,#900202 44%,#5F0000 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #A90303 0%,#900202 44%,#5F0000 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #A90303 0%,#900202 44%,#5F0000 100%); /* IE10+ */ background: linear-gradient(top, #A90303 0%,#900202 44%,#5F0000 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#A90303', endColorstr='#5F0000',GradientType=0 ); /* IE6-9 */ } .menu-item h4:hover { background: #cc002c; /* Old browsers */ background: -moz-linear-gradient(top, #CD0000 0%, #6E0000 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6E0000), color-stop(100%,#6d0019)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #CD0000 0%,#6E0000 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #CD0000 0%,#6E0000 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #CD0000 0%,#6E0000 100%); /* IE10+ */ background: linear-gradient(top, #CD0000 0%,#6E0000 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#CD0000', endColorstr='#6E0000',GradientType=0 ); /* IE6-9 */ } /*First Item Styles*/ .alpha p { font-size: 11px; padding: 8px 12px; color: #aaa; } /*ul Styles*/ .menu-item ul { background: #fff; font-size: 12px; line-height: 20px; list-style-type: none; overflow: hidden; padding: 0px; } .menu-item ul a { margin-left: 20px; text-decoration: none; color: #AE1F1F; display: block; width: 200px; } /*li Styles*/ .menu-item li { border-bottom: 1px solid #eee; } .menu-item li:hover { background: #eee; } /*ul Styles*/ .menu-item ul { background: #fff; font-size: 12px; line-height: 20px; height: 0px; /*Collapses the menu*/ list-style-type: none; overflow: hidden; padding: 0px; } /*ul Styles*/ .menu-item ul { background: #fff; font-size: 12px; line-height: 20px; height: 0px; list-style-type: none; overflow: hidden; padding: 0px; /*Animation*/ -webkit-transition: height 1s ease; -moz-transition: height 1s ease; -o-transition: height 1s ease; -ms-transition: height 1s ease; transition: height 1s ease; } .menu-item:hover ul { height: 250px; } .menu-item ul { margin-top:-1%; margin-bottom:-1%; } </style>
THank you.
Sat, 2016-05-28 08:17
#1
Hi paxomar, You will probably
Hi paxomar,
You will probably want to use JavaScript to change a class on the element clicked.
Then just replace the hover pseudo class styles with the new class