• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1060
  • Last Modified:

Cufon conflicting with Bootstrap active class


I'm using Bootstrap 3 to create a tabbed navigation. This all works fine. However, I also want to use cufon for the font in the tab headings. As soon as I add this in it overrides the font color which should be applied to my active class.

You can see what I mean on this jsfiddle:

Just comment out this line to see the font colour working correctly:
Cufon.replace('.nav-pills > li > a', { fontFamily: 'Helvetica Neue' });

And leave it uncommented to see the font family working correctly.

Is there any way I can have them both working correctly together? (btw I have tried using @font-face instead but the font doesn't look nearly as good as it does with cufon, so would rather stick with cufon if possible).

  • 2
  • 2
1 Solution
You would need to trap the click event on the tab and call Cufon.refresh()
bess1976Author Commented:
Hi Gary,

Thanks very much for getting back to me. But how would I do that exactly? I'm afraid javascript is definitely not my strong point. I tried using Cufon.refresh() but I think I was putting it in the wrong place. Are you saying I need to amend the Bootstrap core files? I'd rather not do this if possible. If there's any chance you could show me an example on the jsfiddle I'd be very grateful.
With jquery which seems to be recommended for Cufon (and a lot easier) add

$("#pills li").click(function(){
        Cufon.replace("#pills li", { color:"#666" });
        Cufon.replace(this, { color:"#fff" });

Open in new window

bess1976Author Commented:
Thanks so much for your help - that's works perfectly. Much appreciated.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now