【发布时间】:2011-09-02 01:36:17
【问题描述】:
马上,我只想预先感谢任何插话的人。stackoverflow 让我对人性感觉好一点。
问题:我有一个“单页”网站,其中主要内容通过 ajax 重新加载,但导航和页脚保持不变。我正在为导航和 Jquery 使用 Cufon 字体将“当前”类附加到当前链接。出于某种原因,即使在当前类被删除并添加到另一个链接之后,悬停状态仍然存在。
HTML:
<nav id="banner"><ul><li><a>1</a></li><li><a>2</a></li></ul></nav>
CUFON:
Cufon.replace('#banner a',{fontFamily: 'Gotham-Book', fontStyle: 'normal', hover: true});
点击功能:
$("nav").delegate("a", "click", function() {
window.location.hash = $(this).attr("href");
$("#banner nav a.current").removeClass("current");
$(this).addClass("current");
return false;
});
CSS:
#banner {color: #000;}
#banner a:hover {color: #be1e2c;}
#banner nav ul li a.current {color: #be1e2c;}
【问题讨论】:
标签: jquery hyperlink hover cufon