S
S
saveTibet2016-11-22 23:34:59
css
saveTibet, 2016-11-22 23:34:59

How to make the menu color change depending on the active section?

There is a one-page website with a fixed menu. When scrolling, the section of the site that is in view is assigned the .active class. Sections have a different background - dark and light. Some sections of the menu are hard to see, so I want it to change color when the desired section is active. Is it possible to write a SASS condition that satisfies these requirements?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
iBird Rose, 2016-11-22
@alekseyruzov

what about sass? you need to give a class for each section. for example for body. well, or for a general wrpapper, if there is one. and depending on these classes, already set your own unique color for the menu.
ps and you can do this in the same script where you hang .active on the section. just hang the class of this section on the body there, for example

A
Ankhena, 2016-11-23
@Ankhena

In JS, the condition, depending on the height of the scroll, is to assign the class light or dark (or whatever you like to call them)

S
Sergei Nazarenko, 2016-11-23
@nazares

something like this jsfiddle.net/mekwall/up4nu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question