Task:
There are 10 balls, the first 4 with transparency (1st - white, 2 - light blue, 3 - blue, 4 - bluish), the rest are all blue. It is necessary to realize a smooth change of the color of the balls when scrolling, if you scroll down - the colors, as it were, “run across” to the right, when you scroll upwards - to the left.
Now made only frame. In one div'e 2 span of the object - one is blue, the other is white. The idea is this, when scrolling, add white opa different opacity.
But how to do it - I have no idea.
Thanks for attention!
html
<div class="section"> <div class="woman-spine"> <div class="dot" data-scroll="1"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="2"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="3"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="4"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="5"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="6"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="7"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="8"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="9"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> <div class="dot" data-scroll="10"> <span class="spine-dot"></span> <span class="spine-dot-white"></span> </div> </div> </div> css
body{ height: 1200px; } .section { padding: 150px 0; } .woman-spine { position: absolute; top: 87%; left: 24%; width: 50%; } .dot { position: relative; float: left; margin-right: 3%; width: 15px; height: 15px; } .spine-dot { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #00aeef; } .spine-dot-white { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #FFF; opacity: 0; }