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3IiOmZhbHNlLCJjdF9jb250ZW50IjoiIn0sImRlcHRoIjo0fV0sImRlcHRoIjo2fSwiY2xhc3NlcyI6eyJpY29ib3gxIjp7ImtleSI6Imljb2JveDEiLCJtZWRpYSI6eyJ0YWJsZXQiOnsib3JpZ2luYWwiOnsibWFyZ2luLWJvdHRvbSI6IjEwIn19fSwib3JpZ2luYWwiOnsiaWNvbl9ib3hfY29udGVudF9hbGlnbm1lbnQiOiJjZW50ZXIiLCJiYWNrZ3JvdW5kLWNvbG9yIjoiIzAwMDAwMCIsInBhZGRpbmctdG9wIjoiMTAiLCJwYWRkaW5nLWxlZnQiOiI0MCIsInBhZGRpbmctcmlnaHQiOiI0MCIsInBhZGRpbmctYm90dG9tIjoiMTAiLCJvdmVyZmxvdyI6ImhpZGRlbiIsIm1heC13aWR0aCI6IjQwMCIsIndpZHRoLXVuaXQiOiIlIiwid2lkdGgiOiIxMDAiLCJtYXJnaW4tcmlnaHQiOiIyMCJ9fX0sImNvbG9ycyI6eyIxIjp7ImlkIjoxLCJuYW1lIjoic3VwYXJlZCIsInZhbHVlIjoiI2ZmNTI1MiJ9fX0=
In this tutorial, I use the Icon Box element because the structure is already in place but you can do exactly the same kind of effect with your own box.
To understand how it works, let's study it first.
Add an Icon box element (keep the default settings) and in the frontend, open the devtools (F12) :
Here is a simplified version, with all the classes (it's just what we need) :
The classes names are pretty self-explanatory. There is one class for the icon, one for the heading, and one for the text.
(Note that there is also a class for the link, but to make it simpler, we can skip it for the moment).
So now that we have a clear view of the full structure with the classes, we can easily animate these elements with some basic CSS.
Step 1
Add a class to the Icon Box element : .icobox1
Step 2
For the settings, it's just very basic for the moment.
Step 3
Let's start with the custom CSS.
.oxy-icon-box-text
Let's move the text out of the box with a translateY.
.icobox1 .oxy-icon-box-text {
transform: translatey(150%)
}
Here is how it looks like:
.oxy-icon-box-icon & .oxy-icon-box-heading
Let's move the icon and the title somewhere in the middle. Still with some TranslateY.
.icobox1 .oxy-icon-box-icon {
transform: translatey(50px)
}
.icobox1 .oxy-icon-box-heading {
transform: translatey(50px)
}
Step 4
Now we can work on the transitions.
Animate the text
We have to add the transition CSS property.
What we are doing here, is to change the position of the text, then move it back when the box is on hover.
.icobox1 .oxy-icon-box-text {
transition: 0.5s ease transform;
transform: translatey(150%)
}
.icobox1:hover .oxy-icon-box-text {
transform: translatey(0)
}
Move your mouse over the box:
Animate the icon and the title
Just like for the text, we must add a transition.
This time we also change the opacity of the icon, so we need to apply the transition to 'all'.
.icobox1 .oxy-icon-box-icon {
transition: 0.5s ease all;
transform: translatey(50px)
}
.icobox1:hover .oxy-icon-box-icon {
transform: translatey(20px);
opacity: .5
}
And finally for the title, we only change the opacity.
.icobox1 .oxy-icon-box-heading {
transition: 0.5s ease opacity;
transform: translatey(50px)
}
.icobox1:hover .oxy-icon-box-heading {
opacity: 0!important
}
All our elements are animated now:
Let's wrap this up and add the finish touch.
We change the mouse pointer and we hide everything outside the Icon Box:
.icobox1 {
cursor: pointer;
overflow: hidden
}
The full CSS:
.icobox1 {
cursor: pointer;
overflow: hidden
}
.icobox1 .oxy-icon-box-text {
transition: 0.5s ease transform;
transform: translatey(200%)
}
.icobox1:hover .oxy-icon-box-text {
transform: translatey(0)
}
.icobox1 .oxy-icon-box-icon {
transition: 0.5s ease all;
transform: translatey(50px)
}
.icobox1:hover .oxy-icon-box-icon {
transform: translatey(20px);
opacity: .5
}
.icobox1 .oxy-icon-box-heading {
transition: 0.5s ease opacity;
transform: translatey(50px)
}
.icobox1:hover .oxy-icon-box-heading {
opacity: 0!important
}
Some tips about the alignments for the Icon Box
And if you have some trouble to make your own, you can also check my design set Unlimited Elements.
Here are some elements from that set: