Skip to content

Instantly share code, notes, and snippets.

@rootux
Created November 21, 2012 12:16
Show Gist options
  • Save rootux/4124581 to your computer and use it in GitHub Desktop.
Save rootux/4124581 to your computer and use it in GitHub Desktop.
A CodePen by Gal Bracha. Wash over image animation - Using css transition to create a wash effect over an image that changes from white to black
<html>
<head>
</head>
<body>
<div class="creative">
<img src="http://25.media.tumblr.com/tumblr_mc1h3mRdRW1r4nnyto1_400.gif">
<div class="creativeWash">
<img src="http://openclipart.org/people/Rocket000/Rocket000_emblem-star.svg" class="star">
<div>
<p class="creativeTitle">This is a title</p>
<p class="creativeBody">Trimmed body...</p>
</div>
</div>
</div>
</body>
$(function() {
$('.creative').hover(
function() {
$('.creativeWash',this).addClass('creativeWashOpened');
},
function() {
$('.creativeWash',this).removeClass('creativeWashOpened');
});
});
.creative {
display: inline-block;
position: relative;
}
.creativeWash {
position:absolute;
bottom: 0px;
color: black;
font-size: 24px;
font-family: sans-serif;
background: white;
width: 100%;
opacity: 0.85;
padding: 5px 0;
height:28px;
overflow: hidden;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.creativeWashOpened {
height:60px;
background: #000;
color: white;
opacity: 0.75;
}
.creativeWash div {
display: inline-block;
}
.star {
margin: 2px 7px;
vertical-align: top;
height: 32px;
width: 32px;
}
p {
margin: 0;
padding-bottom:5px;
}
.creativeTitle {
display: inline-block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment