When I try to move the mouse over the drop-down submenu form the main drop down menu the main drop down menu disappears and the next drop-down (if there is drop down items) menu item is shown. Maybe there is something wrong with the CSS code. I tried using display: inline-block; as others have suggested but it is still not working.
CSS code:
.gva-navigation > ul > li {
position: relative;
z-index: 100;
}
.gva-navigation > ul > li > ul {
position: absolute;
padding: 0 1000em; /* trick from css-tricks comments */
margin: 0 -1000em; /* trick from css-tricks comments */
}
.gva-navigation > ul > li:hover > ul {
position: absolute;
display: none;
left: 0;
}
.gva-navigation > ul > li > ul > li {
position: absolute;
display: inline-block;
left: 0;
}
.gva-navigation > ul > li > ul > li > ul {
position: absolute;
}
Html Code:
<div class="gva-navigation">
<ul class="clearfix gva_menu gva_menu_main">
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Departments <span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
</li>
<li class="menu-item">
<a target="" href="en/Economics.html">
ECONOMICS/ISLAMIC ECONOMICS</a>
</li>
<li class="menu-item">
<a target="" href="en/Finance.html">
FINANCE/ISLAMIC FINANCE</a>
</li>
<li class="menu-item">
<li class="menu-item menu-item--expanded">
<a target="" href="en/Training.html">
TRAINING </a>
</li>
<li class="menu-item mune-item--expanded">
<a target="" href="en/Information_Center.html">
INFORMATION CENTER </a>
</li>
<li class="menu-item mune-item--expanded">
<a target="" href="en/JOURNAL_OF_NEW_ECONOMICS.html">
JOURNAL OF NEW ECONOMICS </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="" href="#">
Teaching & Performance <span class="icaret nav-plus fa fa-angle-down"></span></a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/Teaching_Approaches.html">
Teaching Approaches</a>
</li>
<li class="menu-item">
<a target="" href="en/Midway_Approach.html">
Midway Approach</a>
<li class="menu-item">
<a target="" href="en/Graduates_Profile.html">
Graduates Profile</a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Admissions <span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/students.html">
Admission Requirements <span class="icaret nav-plus fa fa-angle-down"></span></a>
<ul class="menu sub-menu">
<li class="menu-item">
<a target="" href="en/3_Tracks_for_BA_Holders.html">
3 Tracks for BA Holders</a>
</li>
<li class="menu-item">
<a target="" href="en/Language_Requirements.html">
Language Requirements</a>
</li>
<li class="menu-item">
<a target="" href="en/Grades.html">
Grades</a>
</li>
<li class="menu-item">
<a target="" href="en/Admission_Course_Requirements.html">
Admission Course requirements</a>
</li>
</ul>
</li>
<li class="menu-item">
<a target="" href="https://obs.asbu.edu.tr/oibs/ogrenci/login.aspx">
Applications and Deadlines </a>
</li>
<li class="menu-item">
<a target="" href="https://www.asbu.edu.tr/tr/akademik-takvim">
International Students </a>
</li>
<li class="menu-item">
<a target="" href="en/student-work-forms.html">
Apply </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Student <span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/students.html">
For Students </a>
</li>
<li class="menu-item">
<a target="" href="https://obs.asbu.edu.tr/oibs/ogrenci/login.aspx">
Student Information System </a>
</li>
<li class="menu-item">
<a target="" href="https://www.asbu.edu.tr/tr/akademik-takvim">
Academic Calendar </a>
</li>
<li class="menu-item">
<a target="" href="en/student-work-forms.html">
Student Work Forms </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Course Requirements<span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/MA_and_PHD_in_Economics.html">
MA & PHD IN ECONOMICS/ISLAMIC ECONOMICS <br> (DOUBLE MAJOR)</a>
</li>
<li class="menu-item">
<a target="" href="en/MA_and_PHD_in_Finance.html">
MA & PHD IN FINANCE/ISLAMIC<br>FINANCE<br>(DOUBLE MAJOR)</a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">About <span class="icaret nav-plus fa fa-angle-down"></span></a>
<ul class="menu sub-menu" style="margin-top: -30px;
left: -100px;">
<li class="menu-item" style="display: inline-block">
<a target="_self" href="#">
Founding Stage<span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu">
<li class="menu-item">
<a target="" href="en/background.html" style="white-space: nowrap;">
Background </a>
</li>
<li class="menu-item">
<a target="" href="en/objectives.html">
Objectives </a>
</li>
<li class="menu-item">
<a target="" href="en/name.html">
Name </a>
</li>
<li class="menu-item">
<a target="" href="en/approach.html">
Approach </a>
</li>
</ul>
</li>
<li class="menu-item">
<a target="_self" href="en/Faculty.html">
Faculty </a>
</li>
<li class="menu-item">
<a target="" href="https://asbu.edu.tr/tr/iletisim-bilgileri">
Contact Information </a>
</li>
<li class="menu-item">
<a target="" href="en/contact.html">
Contact Form </a>
</li>
<li class="menu-item">
<a target="" href="https://asbu.edu.tr/tr/ulasim">
Transportation </a>
</li>
<li class="menu-item">
<a target="" href="https://asbu.edu.tr/tr/contact/bilgi_edinme">
Getting Information </a>
</li>
<li class="menu-item">
<a target="_self" href="en/Stages_of_Implementation.html">
Stages of Implementation </a>
</li>
<li class="menu-item">
<a target="" href="en/Organisational_Chart.html">
Organisational Chart </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--collapsed">
<a target="_self" href="en/Annotated_List_of_Courses.html">
Annotated List of Courses </a>
</li>
</ul>
</div>
Any Fixes? Thank you.
I removed all other css and the functionality works.
You are looking for something like:
.gva-navigation>ul>li>ul {
display: none;
}
.gva-navigation>ul>li:hover>ul {
display: inline;
}
Related
i am using the bootstrap dropdown menu. and transitions between pages, I can provide my transitions without refreshing the page, but there is a situation where I get stuck, when the menu a href and submenu a hrefs are clicked, the dropdown remains open, I want it to be closed in an animated way. Finally, when "menu-item-has-children a" is clicked, "display: none" opens and when I click it again, it doesn't close. I couldn't understand why this was happening.
<div class="header__navigation">
<nav class="navbar-collapse collapse" id="cargopress-navbar-collapse" aria-expanded="true">
<ul class="main-navigation js-main-nav js-dropdown">
<li class="menu-item">
Home
</li>
<li class="menu-item menu-item-has-children">
<a class="sub-menu-a" href="#">
<span class="nav_item_wrap">Corporate</span>
<span class="nav_item_down"><i class="fa fa-angle-down"></i></span>
</a>
<ul role="menu" class="sub-menu" style="display: none;">
<li class="menu-item">
<a class="list-entry" href="http://localhost/en/corporate/about-us">ABOUT US</a>
</li>
</ul>
</li>
<li class="menu-item menu-item-has-children">
<a class="sub-menu-a" href="#">
<span class="nav_item_wrap">Services</span>
<span class="nav_item_down"><i class="fa fa-angle-down"></i></span>
</a>
<ul role="menu" class="sub-menu" style="display: none;">
<li class="menu-item">
<a class="list-entry" href="http://localhost/en/services/land-transportation">LAND TRANSPORTATION</a>
</li>
</ul>
</li>
<li class="menu-item menu-item-has-children">
<a class="sub-menu-a" href="#">
<span class="nav_item_wrap">İmportant İnformation</span>
<span class="nav_item_down"><i class="fa fa-angle-down"></i></span>
</a>
<ul role="menu" class="sub-menu" style="display: none;">
<li class="menu-item">
<a class="list-entry" href="http://localhost/en/important-informations/highway">HİGHWAY</a>
</li>
</ul>
</li>
<li class="menu-item">Contact Us</li>
</ul>
</nav>
</div>
$(".sub-menu").hide();
$('.menu-item-has-children a').click(function (event) {
event.preventDefault();
var elems = $(this).closest('li');
elems.siblings('li').find('ul').hide();
if (elems.find('.sub-menu').length) {
$(this).siblings('.sub-menu', elems).show();
}
});
$("li.menu-item").click(function () {
$('.navbar-collapse').removeClass('in');
});
$(".menu-item ul li a").click(function () {
$('.navbar-collapse').removeClass('in');
});
I think that is just a matter of using .toggle() instead of .show() to be able to close a sub-menu when it is already opened.
$(".sub-menu").hide();
$(".menu-item-has-children a").click(function (event) {
event.preventDefault();
var elems = $(this).closest("li");
elems.siblings("li").find("ul").hide();
if (elems.find(".sub-menu").length) {
$(this).siblings(".sub-menu", elems).toggle(); // .toggle() instead of .show() here...
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="header__navigation">
<nav class="navbar-collapse collapse" id="cargopress-navbar-collapse" aria-expanded="true">
<ul class="main-navigation js-main-nav js-dropdown">
<li class="menu-item">
Home
</li>
<li class="menu-item menu-item-has-children">
<a class="sub-menu-a" href="#">
<span class="nav_item_wrap">Corporate</span>
<span class="nav_item_down"><i class="fa fa-angle-down"></i></span>
</a>
<ul role="menu" class="sub-menu" style="display: none;">
<li class="menu-item">
<a class="list-entry" href="http://localhost/en/corporate/about-us">ABOUT US</a>
</li>
</ul>
</li>
<li class="menu-item menu-item-has-children">
<a class="sub-menu-a" href="#">
<span class="nav_item_wrap">Services</span>
<span class="nav_item_down"><i class="fa fa-angle-down"></i></span>
</a>
<ul role="menu" class="sub-menu" style="display: none;">
<li class="menu-item">
<a class="list-entry" href="http://localhost/en/services/land-transportation">LAND TRANSPORTATION</a>
</li>
</ul>
</li>
<li class="menu-item menu-item-has-children">
<a class="sub-menu-a" href="#">
<span class="nav_item_wrap">İmportant İnformation</span>
<span class="nav_item_down"><i class="fa fa-angle-down"></i></span>
</a>
<ul role="menu" class="sub-menu" style="display: none;">
<li class="menu-item">
<a class="list-entry" href="http://localhost/en/important-informations/highway">HİGHWAY</a>
</li>
</ul>
</li>
<li class="menu-item">Contact Us</li>
</ul>
</nav>
</div>
Edit based on comments.
my pages are running with xhr request
So I now assume that a click on a .list-entry link (link on the second menu level) triggers an xhr to update a part of the page... And that menu stays opened because it is not part of the page that changes.
So you would just need additionnal event handler. Something like:
$(".list-entry").click(function(){
$(".sub-menu").hide();
})
<nav class="navbar">
<ul class="navbar__list">
<li class="navbar__brand">
<img src="imgs/logo.webp" alt="logo" class="navbar__brand--logo" />
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Home</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">About</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Performance</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Get started</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">News</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Contact</a>
</li>
<div class="navbar__buttons">
<li class="navbar__item">
<a class="navbar__link" href="#">Sign up</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Login</a>
</li>
</div>
</ul>
</nav>
In the above code , I want the div with the class navbar__buttons to be floated to the right side and aligned vertically with the other navbar__item items .
what I already Have :
here is my css
width: 100%;
&__item {
display: inline-block;
font-weight: 700;
transform: translateY(-1rem);
&:not(:last-child) {
margin-right: 2rem;
}
}
&__brand {
display: inline-block;
margin-right: 2rem;
width: 14rem;
&--logo {
width: 100%;
}
}
&__buttons {
display: inline-block;
float: right;
}
I want the div with class navbar__buttons to be floated right and in the same row as the rest of the navbar items
Note : I'm using css/scss
Flexbox
ul {
list-style-type: none;
display: flex;
}
li {
padding: .25em;
}
li:nth-last-child(2) {
margin-left: auto;
}
<nav class="navbar">
<ul class="navbar__list">
<li class="navbar__brand">
<img src="imgs/logo.webp" alt="logo" class="navbar__brand--logo" />
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Home</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">About</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Performance</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Get started</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">News</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Contact</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Sign up</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Login</a>
</li>
</ul>
</nav>
You can achieve the layout you're looking for using flex CSS properties on your elements.
First, I'd tweak your HTML slightly by moving navbar__buttons outside of navbar__list:
<nav class="navbar">
<ul class="navbar__list">
<li class="navbar__brand">
<img src="http://placekitten.com/200/100" alt="logo" class="navbar__brand--logo" />
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Home</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">About</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Performance</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Get started</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">News</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Contact</a>
</li>
</ul>
<ul class="navbar__buttons">
<li class="navbar__item">
<a class="navbar__link" href="#">Sign up</a>
</li>
<li class="navbar__item">
<a class="navbar__link" href="#">Login</a>
</li>
</ul>
</nav>
This will allow you to utilize the flex properties as I outline below.
Displaying your navbar as flex allows you to utilize justify-content: space-between;, which essentially distributes the navbar's children evenly on the line, with the first element on the left and the last element on the right, thus pushing your navbar__buttons to the right side:
.navbar {
width: 100%;
display: flex;
justify-content: space-between;
}
From there, your navbar__buttons links would be aligned to the top (aka not aligned with your other nav links). So, you need to also add a few flex properties to your navbar__buttons:
.navbar__buttons {
display: flex;
align-items: flex-end;
}
Displaying navbar_buttons as flex allows you to use align-items: flex-end;, which aligns it's children to the bottom of the container, aligning them with the rest of your nav links.
Here's a working codepen example based on your code: https://codepen.io/mmshr/pen/eaOWPW
Looking at the screen shot of the website you will see there is a large spacing between the first row and second row of menu items. I want to make this spacing as low as possible.
Here is the relevant css:
.gva-navigation {
width: 100%;
/* Spans the width of the page */
height: 50px;
margin: 0;
/* Ensures there is no space between sides of the screen and the menu */
z-index: 99;
/* Makes sure that your menu remains on top of other page elements */
position: relative;
}
#wrap {
height: 50px;
padding: 0;
margin: 0;
position: absolute;
/* Ensures that the menu doesn’t affect other elements */
#border-right: 1px solid #54879d;
}
.gva-navigation li {
height: 25;
width: auto;
/* Each menu item is 150px wide */
#float: left;
/* This lines up the menu items horizontally */
#text-align: center;
/* All text is placed in the center of the box */
list-style: none;
/* Removes the default styling (bullets) for the list */
padding: 0;
margin: 0;
}
.gva-navigation a {
display: block;
}
.gva-navigation>ul>li>ul {
display: none;
}
.gva-navigation>ul>li:hover>ul {
display: inline;
}
<div class="gva-navigation">
<ul id="wrap" class="clearfix gva_menu gva_menu_main">
<li class="menu-item menu-item--collapsed">
<a target="_self" href="en/Mission_and_Vision.html">
Mission and Vision</a>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Departments <span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
</li>
<li class="menu-item">
<a target="" href="en/Economics.html">
ECONOMICS/ISLAMIC ECONOMICS</a>
</li>
<li class="menu-item">
<a target="" href="en/Finance.html">
FINANCE/ISLAMIC FINANCE</a>
</li>
<li class="menu-item">
<li class="menu-item menu-item--expanded">
<a target="" href="en/Training.html">
TRAINING </a>
</li>
<li class="menu-item mune-item--expanded">
<a target="" href="en/Information_Center.html">
INFORMATION CENTER </a>
</li>
<li class="menu-item mune-item--expanded">
<a target="" href="en/JOURNAL_OF_NEW_ECONOMICS.html">
JOURNAL OF NEW ECONOMICS </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="" href="#">
Teaching & Performance <span class="icaret nav-plus fa fa-angle-down"></span></a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/Teaching_Approaches.html">
Teaching Approaches</a>
</li>
<li class="menu-item">
<a target="" href="en/Midway_Approach.html">
Midway Approach</a>
<li class="menu-item">
<a target="" href="en/Graduates_Profile.html">
Graduates Profile</a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Admissions <span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/students.html">
Admission Requirements <span class="icaret nav-plus fa fa-angle-down"></span></a>
<ul class="menu sub-menu">
<li class="menu-item">
<a target="" href="en/3_Tracks_for_BA_Holders.html">
3 Tracks for BA Holders</a>
</li>
<li class="menu-item">
<a target="" href="en/Grades.html">
Grades</a>
</li>
<li class="menu-item">
<a target="" href="en/Language_Requirements.html">
Language Requirements</a>
</li>
<li class="menu-item">
<a target="" href="en/Admission_Course_Requirements.html">
Admission Course requirements</a>
</li>
</ul>
</li>
<li class="menu-item">
<a target="" href="https://obs.asbu.edu.tr/oibs/ogrenci/login.aspx">
Applications and Deadlines </a>
</li>
<li class="menu-item">
<a target="" href="https://www.asbu.edu.tr/tr/akademik-takvim">
International Students </a>
</li>
<li class="menu-item">
<a target="" href="en/student-work-forms.html">
Apply </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Student <span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/students.html">
For Students </a>
</li>
<li class="menu-item">
<a target="" href="https://obs.asbu.edu.tr/oibs/ogrenci/login.aspx">
Student Information System </a>
</li>
<li class="menu-item">
<a target="" href="https://www.asbu.edu.tr/tr/akademik-takvim">
Academic Calendar </a>
</li>
<li class="menu-item">
<a target="" href="en/student-work-forms.html">
Student Work Forms </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">
Course Requirements<span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu" style="margin-top: -30px;">
<li class="menu-item">
<a target="" href="en/MA_and_PHD_in_Economics.html">
MA & PHD IN ECONOMICS/ISLAMIC ECONOMICS <br> (DOUBLE MAJOR)</a>
</li>
<li class="menu-item">
<a target="" href="en/MA_and_PHD_in_Finance.html">
MA & PHD IN FINANCE/ISLAMIC<br>FINANCE<br>(DOUBLE MAJOR)</a>
</li>
</ul>
</li>
<li class="menu-item menu-item--expanded">
<a target="_self" href="#">About <span class="icaret nav-plus fa fa-angle-down"></span></a>
<ul class="menu sub-menu" style="margin-top: -30px;
left: -100px;">
<li class="menu-item" style="display: inline-block">
<a target="_self" href="#">
Founding Stage<span class="icaret nav-plus fa fa-angle-down"></span> </a>
<ul class="menu sub-menu">
<li class="menu-item">
<a target="" href="en/background.html" style="white-space: nowrap;">
Background </a>
</li>
<li class="menu-item">
<a target="" href="en/objectives.html">
Objectives </a>
</li>
<li class="menu-item">
<a target="" href="en/name.html">
Name </a>
</li>
<li class="menu-item">
<a target="" href="en/approach.html">
Approach </a>
</li>
</ul>
</li>
<li class="menu-item">
<a target="_self" href="en/Faculty.html">
Faculty </a>
</li>
<li class="menu-item">
<a target="" href="https://asbu.edu.tr/tr/iletisim-bilgileri">
Contact Information </a>
</li>
<li class="menu-item">
<a target="" href="en/contact.html">
Contact Form </a>
</li>
<li class="menu-item">
<a target="" href="https://asbu.edu.tr/tr/ulasim">
Transportation </a>
</li>
<li class="menu-item">
<a target="" href="https://asbu.edu.tr/tr/contact/bilgi_edinme">
Getting Information </a>
</li>
<li class="menu-item">
<a target="_self" href="en/Stages_of_Implementation.html">
Stages of Implementation </a>
</li>
<li class="menu-item">
<a target="" href="en/Organisational_Chart.html">
Organisational Chart </a>
</li>
</ul>
</li>
<li class="menu-item menu-item--collapsed">
<a target="_self" href="en/Annotated_List_of_Courses.html">
Annotated List of Courses </a>
</li>
</ul>
</div>
How to reduce vertical spacing between top menu items and other menu items that wrap to the second line or row?
please, try to add this to your css:
#wrap {
height: 50px;
padding: 0;
margin: 0;
position: absolute; /* Ensures that the menu doesn’t affect other elements */
#border-right: 1px solid #54879d;
line-height:12px
}
You just need to change a line in your CSS. You have height: 25;, make it height: 25px. Try this code.
.gva-navigation li {
height: 25px;
}
I would like to get some advice on WAI-ARIA markup I have added to my paginated post navigation.
Does this look correct, am I missing anything?
Should anything be added/removed to the current page link (#2)?
Also, curious on my "Page Count" and "View All" sections what if anything can be added to make it more ARIA-friendly.
<nav role="navigation" class="post-navigation">
<ul role="menubar" class="pagination">
<!-- Page Count -->
<span class="page-count">Page 2 of 4 </span>
<li aria-label="Previous">
<a role="menuitem" aria-posinset="1" data-pagenum="1" href="#">
<span aria-hidden="true">«</span>
</a>
</li>
<li>
<a role="menuitem" aria-posinset="1" data-pagenum="1" href="">1</a>
</li>
<li class="active">
<span role="menuitem" aria-posinset="2">2</span>
</li>
<li>
<a role="menuitem" aria-posinset="3" data-pagenum="3" href="#">3</a>
</li>
<li>
<a role="menuitem" aria-posinset="4" data-pagenum="4" href="#">4</a>
</li>
<li aria-label="Next">
<a role="menuitem" aria-posinset="3" data-pagenum="3" href="#">
<span aria-hidden="true">»</span>
</a>
</li>
<!-- View All link handing -->
<li aria-label="View All">
<a role="menuitem" href="#?viewall">View All</a>
</li>
</ul>
</nav>
<div class="content">
<ul class="clean menu" id="topics">
<li class="drop png">
<div>
<span href="#" id="phone" style="BACKGROUND-POSITION: 13px -79px">Phone</span>
</div>
<ul class="clean menu sub">
<li>
<a cat="tech" class="sec_phone_0" href="javascript:void(0);" name="&lid=choose_category_phone_digital" rel="1">FiOS Digital Voice</a>
</li>
<li class="last">
<a cat="tech" class="sec_phone_1" href="javascript:void(0);" name="&lid=choose_category_phone_dialup" rel="1">Home Phone(Copper)</a>
</li>
<li class="last">
<a cat="tech" class="sec_phone_2" href="javascript:void(0);" name="&lid=choose_category_phone_fiosVoice" rel="1">FiOS Voice</a>
</li>
<li class="last" style="margin-bottom:7px;">
<a cat="tech" class="sec_phone_2" href="javascript:void();" name="&lid=choose_category_phone_wireless" rel="1">Verizon Wireless</a>
</li>
</ul>
</li>
</ul>
</div>
Now I need to select the "cat" value of Fios Voice. How can I do this in Mootools v1.3.2?
Need to set the value in cookie.
This script gets the property of link on click event.
window.addEvent('domready',function(){
$$('ul.sub')[0].getElements('a').each(function(el,ind){
el.addEvent('click',function(){
var cat = el.getProperty('cat');
alert(cat)
})
})
})
For case when <a cat="tech1" class="sec_phone_0 active" href="javascript:void(0);" name="&lid=choose_category_phone_digital" rel="1">FiOS Digital Voice</a> has class="active"
window.addEvent('domready',function(){
if($$('ul.sub')[0].getElements('a.active')[0]){
var cat = $$('ul.sub')[0].getElement('a.active').getProperty('cat');
alert(cat);
}
})