Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Colin Marshall
32,861 PointsRotate Image 360 degrees as it fades in
Hey guys,
I have a logo that fades using javascript after the page loads (Example Here). I was wondering how I would go about making the logo make one full rotation(360 degrees) while it fades in, and then have it stop rotating?
This is my code so far just for the fade in:
$header_logo = $('.header__logo');
$header_logo.delay(500).fadeIn(1250);
Thanks!
1 Answer

LaVaughn Haynes
12,397 PointsHere it is in css working on hover. You can apply the changes via jQuery for the same effect. Obviously in reverse order (invisible to visible)
<!DOCTYPE html>
<html>
<head>
<title>Object</title>
<style>
#box{
width: 300px;
height: 300px;
background-color: pink;
margin: 100px auto;
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
opacity: 1;
filter: alpha(opacity=1);
transition: all 1s;
}
#box:hover{
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
opacity: 0;
filter: alpha(opacity=0);
}
</style>
</head>
<body>
<div id="box"></div>
</body>
</html>
LaVaughn Haynes
12,397 PointsLaVaughn Haynes
12,397 PointsIt might be easier to just add a class like this
Colin Marshall
32,861 PointsColin Marshall
32,861 PointsThanks! Ya I was trying hard to figure out how I would do that since it was activated on hover. The class makes a lot more sense. Hopefully I can take it from here, I'll let you know the results. Thanks again!
LaVaughn Haynes
12,397 PointsLaVaughn Haynes
12,397 PointsNo problem. The Jekyll site looks good
Colin Marshall
32,861 PointsColin Marshall
32,861 PointsThanks man! It's still a work in progress, but now it looks a lot better thanks to you!
Check it out: http://colin-marshall.github.io/