Hi @Nikki Dean
Your second codepen shows a 404.
There would be a number of ways to do this. But to just add to what you have without changing your code.
You can just add a class called active when you click the magnifying glass. And then remove the active class when you click the X to reverse. Then just add a CSS class to force the rotation back to 0 so any hover will not be applied.
JS I modified:
search.addEventListener('click', function(){
search.classList.add("active"); // added this to add .active class
toggleSearch.play();
})
searchExit.addEventListener('click', function(){
search.classList.remove("active"); // added this to remove .active class
toggleSearch.reverse();
})
The CSS I modified:
/* force transform rotate to 0 */
.search.active {
-webkit-transform: matrix(1, 0, 0, 1, 0, 0) !important;
transform: matrix(1, 0, 0, 1, 0, 0) !important;
}
There are other ways to modify the way your doing the hover, I'm but glad you got it fixed.
Happy Tweening