0
I have a div that has position: fixed, that is, accompanies the scroll. But I have a problem. Since the div has text with a color, if pass over a div darker, the text will not be visible. Is there any way to apply in css or js for when he came to this div change to another color?
This is the code I have:
<div style="position:fixed;right:10px;top: 50%;transform: translateY(-50%);"><i class="fa fa-chevron-right fa-5x"></i></div>
I know I shouldn’t use style on line but as it is only as testing phase, I am doing so for the easiest code manipulation.
I’ve heard of the method mix-blend-mode but I couldn’t put it into practice. How could I use that method?
One way to do this is to calculate the
scrollTopof the window/body and thescrollTopstatic text. and check if it is in the scroll you want, if you apply css.– Alex
Read this here and see if it helps: https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
– Alex
Only a z-index to play this fixed div over all the content wouldn’t solve your problem? It has some background color, or just the text?
– hugocsl
@hugocsl I have a
divdarker with a dark background. The supposeddivstuck to thescrollis that indicated in the code– I_like_trains
Guy is kind of hard to understand, if you can put the full code of HTML and CSS will get easier to give you an accurate answer.
– hugocsl
@hugocsl https://jsfiddle.net/dagncLy4/ See how the background disappears because it is white and changes to the dark appears? That’s more or less what I want but without the circular background, I want you to change the text if you go over the black div
– I_like_trains