MyFaith
V2EX  ›  问与答

导航标签如何才能做到动态添加 active 样式?

  •  
  •   MyFaith · Jul 6, 2016 · 2604 views
    This topic created in 3640 days ago, the information mentioned may be changed or developed.

    Bootstrap 的导航栏,添加 active 样式后会有背景色,但是切换标签后,如何才能把 active 样式动态切换过去呢?写过 JS ,但是页面会刷新,显示一下瞬间又变回之前的样子了。如果用 preventDefault 又会阻止页面的跳转,有什么好的方法实现呢?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   941 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:36 · PVG 03:36 · LAX 12:36 · JFK 15:36
    ♥ Do have faith in what you're doing.