高亮导航js代码

时间:2017-01-30 09:21:52
【文件属性】:

文件名称:高亮导航js代码

文件大小:2KB

文件格式:TXT

更新时间:2017-01-30 09:21:52

高亮导航 导航

1. 2、/*高亮导航*/ var menuu = $('menu'); var subMenu = menuu.getElements('li'); var currentPage = document.location.href.toString(); var currentPage = currentPage.substr(currentPage.lastIndexOf("/") + 1, currentPage.length); subMenu.each(function(el){ var menua = el.getElement('a'); var page = menua.get('href'); page = page.substr(page.lastIndexOf("/") + 1, page.length); if (page == currentPage){ menua.addClass('select'); } }); 3. void function(){ var objs = $$('.nav-menu li'); var currentPage = document.location.href.toString(); currentPage = currentPage.substr(currentPage.lastIndexOf("/") + 1, currentPage.length); if (currentPage.length < 1) { objs[0].className = "active"; return; } for (var i = 0; i < objs.length; i++) { var page = objs[i].getElement('a').href; page = page.substr(page.lastIndexOf("/") + 1, page.length); if (page == currentPage) objs[i].className = "active"; } }();


网友评论