Navigation link changing class...

User 2706435 Photo


Ambassador
444 posts

I can't explain what's happening.
I add this to the header to be the final word on the class "active:"
<style media="screen" type="text/css">
.active {
color:yellow;
background: red; }
</style>


Magellan applies the class as usual, but ONLY the background color. If the link color is styled at all, the embedded style color of yellow is ignored. You can have the background color styled, and this css will change it, but not the link color.
User 2823310 Photo


Registered User
312 posts

Try adding important Bill that might over ride something being added by foundation?
color:yellow !important;
User 2706435 Photo


Ambassador
444 posts

That seems to be working right now. Thanks! I am having a couple of issues with the magellan component so I don't know if its a "good" or ideal solution.
User 2706435 Photo


Ambassador
444 posts

It turns out, I did not need the !important. My original quick fix for the active class works today, but did not yesterday. A computer restart and or some RSD restarts might have been the reason?

data-active-class="YourSpecialClass"
should be able to specificy any class to be used as the active class instead of being limited to styliing only ".active" - but that class will have to be in a separate stylesheet or embedded in the header section.
User 2706435 Photo


Ambassador
444 posts

No - my mistake, that !imporant is required- I have been getting confused over what examples I was using while doing parallel hand coding in a separate editor.
User 2147646 Photo


Registered User
233 posts

Hi Bill, I think you may just need to be more specific with your selector. For example using Brandon's page, to change the active style of the links in his menu you would need a selector like

li.list-item-link.li-second-nav.active a {
color: yellow;
}

User 2816828 Photo


Registered User
23 posts

Yeah, I was kinda thinking the same thing. Thanks for taking a look and adding to this jamo.

Bill, If it's not to much trouble, would you be able to upload one of your test examples you've been working on? I think it would be helpful to see and look at how you have structured it. Thanks for all the input and testing you've done!
User 2706435 Photo


Ambassador
444 posts

my test samples were just trying to recreate a base magellan component. Odd thing is I am having problems when hand coding it with F6.2 in that the first link is always active because it gets stickied of the section scrolls to it. I think I have the sticky stuff wrong. CC works, except for the active class thing.

The code I posted earlier will work on your project, with the addition of Alter Eagle's fix included here;
<style media="screen" type="text/css">
.active {
color:yellow !important;
background: red; }
</style>


Jamo's idea goes right to the specific element, but I wanted to find a more clean fix that would be more congruent with the Magellan's plugin features. For instance, you can specify a specific class for the active class, it does not have to be ".active" Foundation has a default styling for .active and that is what Magellan defaults to. And if you change the classes of the links, or rename them, you won't have to rename the your substitute active class.

The above code needs to be added in a external stylesheet your create and add to the project, or add it to the page in the header section. I tested the attribute:
data-active-class="YourSpecialClass"

and that will work too so you can have different classes than just one class of "active" with this solution. I am pretty sure there are only two properties for the default active class in Foundation, so anything else you add to it should be good. For styling in RSD, you might was to duplicate the menu line, then style it how you want for the active class - preview in a browser, view the source code, find the class and copy it o your style sheet.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.