i used below menu to show submenu on :hover
for some reason i want to change :Hover
type to click
so i modified my code and below is my code.
when i click it should open its sub menu but when i click it scroll to top of page.
can someone help me. on click to open sub menu.
thanks in advance.
.mega-dropdown {
width: 175px;
height: 54px;
border: 2px solid #e0e0e0;
position: relative;
}
.mega-dropdown.active {
z-index: 200;
}
.mega-dropdown.active:before {
content: "";
position: absolute;
top: -2px;
right: -2px;
left: -2px;
height: 86px;
background: #ffffff;
z-index: 18;
border: 2px solid #77c04b;
-webkit-box-shadow: 0 0 21px 9px rgba(0, 0, 0, 0.14);
-moz-box-shadow: 0 0 21px 9px rgba(0, 0, 0, 0.14);
box-shadow: 0 0 21px 9px rgba(0, 0, 0, 0.14);
}
.mega-filtered-search .mega-dropdown.active:before {
border-color: #0083c9;
}
.mega-dropdown.active:after {
content: "";
position: absolute;
left: 0;
top: 2px;
width: 100%;
height: 80px;
background: #ffffff;
z-index: 25;
}
.mega-dropdown.active>i {
color: #686868;
z-index: 51;
}
.mega-dropdown.active .mega-content {
display: block;
}
.mega-dropdown.active .mega-content>.inner {
padding: 30px;
}
.mega-dropdown>button {
border: none;
background: none;
font-size: 14px;
line-height: 0;
top: 0;
height: 100%;
width: 100%;
position: absolute;
left: 0;
padding: 0 30px 0 15px;
z-index: 60;
text-align: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.mega-dropdown>i {
position: absolute;
right: 15px;
top: 50%;
font-size: 14px;
line-height: 0;
color: #b7b7b7;
z-index: 25;
}
.mega-content {
display: none;
width: 690px;
background: #fff;
border: 2px solid #77c04b;
position: absolute;
top: 100%;
left: -2px;
z-index: 21;
margin-top: 30px;
-webkit-box-shadow: 0 0 21px 9px rgba(0, 0, 0, 0.14);
-moz-box-shadow: 0 0 21px 9px rgba(0, 0, 0, 0.14);
box-shadow: 0 0 21px 9px rgba(0, 0, 0, 0.14);
}
.mega-filtered-search .mega-content {
border-color: #0083c9;
width: 304px;
}
.dropdown-wrap.active .mega-content {
display: block;
}
.dropdown-wrap .mega-content {
margin-top: 0;
border: 1px solid #f1f1f1;
-webkit-box-shadow: 0px 5px 0px 0px rgba(0, 0, 0, 0.14);
-moz-box-shadow: 0px 5px 0px 0px rgba(0, 0, 0, 0.14);
box-shadow: 0px 5px 0px 0px rgba(0, 0, 0, 0.14);
}
.dropdown-wrap .mega-content>.inner {
padding: 30px;
}
.mega-list>header {
font-size: 14px;
color: #151515;
text-transform: capitalize;
position: relative;
padding-left: 30px;
}
.mega-list>header i {
color: #77c04b;
font-size: 24px;
position: absolute;
left: 0;
top: 50%;
line-height: 0;
margin-top: -4px;
}
.mega-list ul {
margin: 15px -30px 0;
padding: 0 0 0 30px;
font-size: 13px;
}
.mega-list ul li {
display: block;
width: 25%;
float: left;
padding-right: 40px;
position: relative;
}
.mega-list ul li:after {
content: "\f105";
font-family: "FontAwesome";
position: absolute;
right: 33px;
top: 50%;
line-height: 0;
}
.mega-list ul li a {
display: block;
color: inherit;
}
.mega-filtered-search {
float: left;
padding-left: 175px;
height: 54px;
width: 540px;
position: relative;
margin-left: 10px;
border: 2px solid #e0e0e0;
}
@media (max-width: 1199px) {
.mega-filtered-search {
width: 400px;
}
}
.mega-filtered-search .mega-dropdown {
height: 50px;
position: absolute;
left: 0;
top: 0;
border: none;
background: #f4f4f4;
}
.mega-filtered-search .search-widget {
height: 50px;
background: none;
}
.category-list {
margin: 0;
padding: 0 0;
position: relative;
z-index: 10;
}
.category-list a {
text-transform: capitalize;
}
.category-list>li {
display: block;
}
.category-list>li>a {
display: block;
padding: 12px 50px 12px 65px;
font-size: 14px;
color: inherit;
text-decoration: none;
position: relative;
}
.category-list>li>a i {
position: absolute;
top: 50%;
left: 15px;
width: 50px;
text-align: center;
line-height: 0;
font-size: 22px;
}
.category-list>li>a:after {
content: "\f105";
font-family: "FontAwesome";
position: absolute;
right: 30px;
top: 50%;
line-height: 0;
}
.category-list>li:hover>a {
background: #0083c9;
color: #ffffff;
}
.category-list>li:hover>ul {
visibility: visible;
filter: alpha(opacity=100);
opacity: 1;
}
.category-list>li>ul {
visibility: hidden;
filter: alpha(opacity=0);
opacity: 0;
position: absolute;
left: 100%;
z-index: -1;
width: 100%;
top: -2px;
bottom: -2px;
overflow-y: auto;
background: #0083c9;
padding: 0 0;
}
.category-list>li>ul li {
display: block;
}
.category-list>li>ul li a {
color: #ffffff;
display: block;
padding: 12px 30px;
font-size: 14px;
text-decoration: none;
}
.category-list>li>ul li a:hover {
background: rgba(0, 0, 0, 0.05);
}
.dropdown-wrap {
text-align: left;
position: relative;
}
.dropdown-wrap.active {
display: block;
}
.dropdown-wrap {
display: none;
z-index: 50;
border: 1px solid #b7b7b7;
background: #ffffff;
width: 180px;
position: absolute;
right: 0;
top: 100%;
-webkit-box-shadow: 0 0 9px 1px rgba(0, 0, 0, 0.14);
-moz-box-shadow: 0 0 9px 1px rgba(0, 0, 0, 0.14);
box-shadow: 0 0 9px 1px rgba(0, 0, 0, 0.14);
}
.dropdown-wrap {
width: 370px;
}
.dropdown-wrap {
font-family: "FontAwesome";
content: "\f0d8";
color: #ffffff;
text-shadow: 0px -2px 0px #b7b7b7;
font-size: 22px;
position: absolute;
right: 15px;
line-height: 0;
top: -2px;
}
.mega-dropdown-wrap {
position: relative;
}
.mega-dropdown-wrap .mega-dropdown {
width: 100%;
border-width: 1px;
height: 42px;
max-width: 570px;
}
.mega-dropdown-wrap .mega-dropdown:before,
.mega-dropdown-wrap .mega-dropdown:after {
display: none !important;
}
.mega-dropdown-wrap .mega-dropdown .mega-content {
min-width: 200px;
width: 50%;
margin-top: 0;
border: 1px solid #e0e0e0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background: #f4f4f4;
left: -1px;
}
.mega-dropdown-wrap .mega-dropdown .mega-content .category-list>li>ul {
border-bottom: 1px solid #e0e0e0;
border-right: 1px solid #e0e0e0;
top: 0;
bottom: 0;
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<div class="mega-dropdown-wrap">
<div class="mega-dropdown active">
<button>Select Category</button>
<i class="fa fa-navicon"></i>
<div class="mega-content">
<ul class="category-list" id="leftmenuidfrmslt">
<li><a href="#"><i class="fa fa-motorcycle"></i>Vehicles</a>
<ul>
<li><a href="#">Cars</a></li>
<li><a href="#">Bus, van, truck</a></li>
<li><a href="#">Industrial Vehicle</a></li>
<li><a href="#">Motorcycle</a></li>
<li><a href="#">Bicycle</a></li>
<li><a href="#">Spare Parts & Accessories</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-tablet"></i>Mobile & Computer</a>
<ul>
<li><a href="#">Mobile</a></li>
<li><a href="#">Computer & Laptop</a></li>
<li><a href="#">tablets</a></li>
<li><a href="#">iPads</a></li>
<li><a href="#">Accessories</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-tv"></i>Home Appliances</a>
<ul>
<li><a href="#">TV-Audio-Video</a></li>
<li><a href="#">Ac</a></li>
<li><a href="#">Washing Machine</a></li>
<li><a href="#">Fridge</a></li>
<li><a href="#">Camera & Lense</a></li>
<li><a href="#">Kitchen Accessories</a></li>
<li><a href="#">Game-Entertainment</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-sofa"></i>Real Estate</a>
<ul>
<li><a href="#">For Sale</a></li>
<li><a href="#">For Rent</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-briefcase"></i>Fashion</a>
<ul>
<li><a href="#">Men</a></li>
<li><a href="#">Women</a></li>
<li><a href="#">Kids</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-buildings"></i>Furniture</a>
<ul>
<li><a href="#">Sofa & Dining</a></li>
<li><a href="#">Bed & Wardrobes</a></li>
<li><a href="#">Home Decor and garden</a></li>
<li><a href="#">Kids Furniture</a></li>
<li><a href="#">other furniture</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-bell"></i>Jobs</a>
<ul>
<li><a href="#">Data Entry & Back Office</a></li>
<li><a href="#">BPO and Telecaller</a></li>
<li><a href="#">Sales and Marketing</a></li>
<li><a href="#">Operator and Technician</a></li>
<li><a href="#">Cook</a></li>
<li><a href="#">IT Engineer and Developer</a></li>
<li><a href="#">Designer</a></li>
<li><a href="#">Reception and Front Office</a></li>
<li><a href="#">Accountant</a></li>
<li><a href="#">Teacher</a></li>
<li><a href="#">Other Jobs</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-hat"></i>Services</a>
<ul>
<li><a href="#">Driver and Taxi</a></li>
<li><a href="#">Electronic Repair</a></li>
<li><a href="#">Computer Center</a></li>
<li><a href="#">Health and Beauty</a></li>
<li><a href="#">Gym and Fitness</a></li>
<li><a href="#">Sports and Equipment</a></li>
<li><a href="#">Other Services</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-dog"></i>Pets</a>
<ul>
<li><a href="#">Dogs</a></li>
<li><a href="#">Cats</a></li>
<li><a href="#">Food & Accessories</a></li>
<li><a href="#">Other Pets</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-heal"></i>Education</a>
<ul>
<li><a href="#">Books</a></li>
<li><a href="#">Online Tutorials</a></li>
<li><a href="#">Tution</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-smile"></i>Matrimony</a>
<ul>
<li><a href="#">I Aa Male</a></li>
<li><a href="#">i am female</a></li>
</ul>
</li>
<li><a href="#"><i class="adicon-hearts"></i>Note & Coin</a>
<ul>
<li><a href="#">Note</a></li>
<li><a href="#">Coins</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>