Icons Filling Effect

Sometimes you just want to create something cool. Maybe for one of those pages - about us, our history etc - where you want to come up with something unique to support your brand. This effect can help you design a cool web page with just a few icons.

The inspiration: some of our users suggested us to take a look at Elliot Condon beautiful portfolio, and create something inspired by the filling effect of the vertical timeline. We did it!

Creating the structure

Before diving into the code, I'm gonna try to explain what's behind this resource. There's no advanced CSS technique, it's all about creating the right assets/icons and play with elements positioning. I started by creating some icons from scratch in Adobe Illustrator. Now what's important is to make transparent the area of the icon you want to fill:

This way you just need to place the illustrations on top of a colored section, then move them. In our specific case the icons move with the scrolling of the page, the colored boxes are in fixed position, underneath.

Just to make sure this is 100% clear, I put together this quick animation to show you the animation process:

That said, the structure is just an unordered list. I created 2 empty list items that will be used to create more space on top and at the bottom of the content.

Adding style

The 2 colored boxes underneath have been created as ::before and ::after pseudo-elements of the .cd-icons-filling element. As you can see, I added a CSS3 transition to one of them, because we are going to change its color in JavaScript while the content is scrolling. The icons are always ::before selectors. Since the separation line below the icons - another .svg file - has to be responsive and change its height according to the content, I added it as a pseudo-element too, with a distance from the top equal to the icon height.

It means that, if you have n .cd-service list items , you have to create (n-1) classes for the .cd-icons-filling element.

When a user starts scrolling, as soon as the .cd-service--2 is visible in the viewport we want the icons filling color to change (that's the first filling color change) so we assign the .cd-icons-filling--new-color-1 class to the .cd-icons-filling element. The same is done for all the other .cd-service-n sections.Finally, when a new .cd-section is visible in the viewport, we assign it the .cd-service--focus class to highlight its content.