【问题标题】:cufon hover state stickingcufon 悬停状态卡住
【发布时间】: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


    【解决方案1】:

    $(this).addClass("current");之后的点击函数中添加Cufon.refresh(); 每次更改 Cufon 文本时都需要此调用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-05
      • 1970-01-01
      • 1970-01-01
      • 2013-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多