0
當前激活鏈接我jQuery中得到這個功能:類添加到使用YUI
jQuery(function() {
jQuery('.primary-nav li').each(function() {
var href = jQuery(this).find('a').attr('href');
if (href === window.location.pathname) {
jQuery(this).addClass('current');
}
});
});
但不幸的是我需要做的完成同樣與YUI庫。如果a href與當前活動頁面相同,則向a元素添加一個類。
非常感謝!