Last active
December 29, 2015 18:39
-
-
Save cnichols-git/7711955 to your computer and use it in GitHub Desktop.
Roll over animation with CSS3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="view rollup one-third first"> | |
<img alt="" src="http://robotlaserparty.com/wp-content/uploads/2013/11/bikes.jpg" width="259" height="194" /> | |
<div class="mask"> | |
<h2>Agent: Jon Smith</h2> | |
Contact me for any of your real estate questions.. | |
<a class="info" href="#">Read More >></a> | |
</div> | |
</div> | |
<div class="view rollup one-third"> | |
<img alt="" src="http://robotlaserparty.com/wp-content/uploads/2013/11/beach-rock.jpg" width="259" height="194" /> | |
<div class="mask"> | |
<h2>Agent: Jon Smith</h2> | |
Contact me for any of your real estate questions.. | |
<a class="info" href="#">Contact Me</a> | |
</div> | |
</div> | |
<div class="view rollup one-third"> | |
<img alt="" src="http://robotlaserparty.com/wp-content/uploads/2013/11/sports-shadows.jpg" width="259" height="194" /> | |
<div class="mask"> | |
<h2>Agent: Jon Smith</h2> | |
Contact me for any of your real estate questions.. | |
<a class="info" href="#">Read More ...</a> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Image roll over animation | |
------------------------------------------------------------------------*/ | |
.rollover-examples { | |
margin: 10px 0; | |
} | |
.example-row { | |
margin: 50px 0; | |
} | |
.rollup .mask { | |
background-color: whitesmoke; | |
-webkit-transform: translateY(300px); | |
-moz-transform: translateY(300px); | |
-o-transform: translateY(300px); | |
-ms-transform: translateY(300px); | |
transform: translateY(300px); | |
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
-webkit-transition: all 0.4s ease-in-out; | |
-moz-transition: all 0.4s ease-in-out; | |
-o-transition: all 0.4s ease-in-out; | |
-ms-transition: all 0.4s ease-in-out; | |
transition: all 0.4s ease-in-out; | |
} | |
.view { | |
width: 279px; | |
float: left; | |
border: 10px solid #fff; | |
overflow: hidden; | |
position: relative; | |
text-align: center; | |
-webkit-box-shadow: 1px 1px 2px #e6e6e6; | |
-moz-box-shadow: 1px 1px 2px #e6e6e6; | |
box-shadow: 1px 1px 2px #e6e6e6; | |
cursor: default; | |
} | |
.view .mask,.view .content { | |
position: absolute; | |
overflow: hidden; | |
top: 0; | |
left: 0; | |
} | |
.view img { | |
width: 100%; | |
display: block; | |
position: relative; | |
} | |
.view h2 { | |
text-transform: uppercase; | |
color: #000; | |
text-align: center; | |
position: relative; | |
font-size: 17px; | |
padding: 10px; | |
background: #fff; | |
margin: 20px 0 0 0; | |
} | |
.view p { | |
font-family: Georgia, serif; | |
font-style: italic; | |
font-size: 12px; | |
position: relative; | |
color: #000; | |
padding: 10px 20px 20px; | |
text-align: center; | |
} | |
.view a.info { | |
display: inline-block; | |
text-decoration: none; | |
padding: 7px 14px; | |
text-transform: uppercase; | |
} | |
.view a.info: hover { | |
-webkit-box-shadow: 0 0 5px #000; | |
-moz-box-shadow: 0 0 5px #000; | |
box-shadow: 0 0 5px #000; | |
} | |
.mask { | |
height: 100%; | |
} | |
.mask p { | |
margin: 6px 4px 0; | |
padding: 0 0; | |
} | |
.rollup img { | |
-webkit-transition: all 0.4s ease-in-out; | |
-moz-transition: all 0.4s ease-in-out; | |
-o-transition: all 0.4s ease-in-out; | |
-ms-transition: all 0.4s ease-in-out; | |
transition: all 0.4s ease-in-out; | |
} | |
.rollup h2 { | |
background: rgba(255, 255, 255, 0.5); | |
color: #000; | |
-webkit-box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5); | |
-moz-box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5); | |
box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5); | |
} | |
.rollup p { | |
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
color: #333; | |
-webkit-transition: all 0.2s linear; | |
-moz-transition: all 0.2s linear; | |
-o-transition: all 0.2s linear; | |
-ms-transition: all 0.2s linear; | |
transition: all 0.2s linear; | |
} | |
.rollup:hover .mask { | |
-webkit-transform: translateX(0px); | |
-moz-transform: translateX(0px); | |
-o-transform: translateX(0px); | |
-ms-transform: translateX(0px); | |
transform: translateX(0px); | |
} | |
.rollup:hover img { | |
-webkit-transform: translateY(300px); | |
-moz-transform: translateY(300px); | |
-o-transform: translateY(300px); | |
-ms-transform: translateY(300px); | |
transform: translateY(300px); | |
} | |
.rollup:hover p { | |
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
} | |
@media only screen and (max-width: 1023px) | |
.view img { | |
width: 100%; | |
display: block; | |
position: relative; | |
} | |
.mask { | |
width: 100%; | |
} | |
.rollup .mask { | |
background-color: whitesmoke; | |
-webkit-transform: translateY(600px); | |
-moz-transform: translateY(600px); | |
-o-transform: translateY(600px); | |
-ms-transform: translateY(600px); | |
transform: translateY(600px); | |
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
-webkit-transition: all 0.4s ease-in-out; | |
-moz-transition: all 0.4s ease-in-out; | |
-o-transition: all 0.4s ease-in-out; | |
-ms-transition: all 0.4s ease-in-out; | |
transition: all 0.4s ease-in-out; | |
} | |
.rollup:hover img { | |
-webkit-transform: translateY(500px); | |
-moz-transform: translateY(500px); | |
-o-transform: translateY(500px); | |
-ms-transform: translateY(500px); | |
transform: translateY(500px); | |
} | |
@media only screen and (max-width: 768px) |
Update for responsive design
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
html and css3 animations