Skip to content

Instantly share code, notes, and snippets.

Created July 7, 2015 14:07
Show Gist options
  • Save anonymous/1c984357c7a204cc65b7 to your computer and use it in GitHub Desktop.
Save anonymous/1c984357c7a204cc65b7 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/ricipeyibi
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.container {
width: 360px;
margin: 0 auto;
height: 500px;
overflow: hidden;
position: relative;
}
.main {
background: url('http://immaceleb.com/wp-content/uploads/2014/10/Amber-Heard-Wallpaper-11.jpg');
width: 100%;
height: 100%;
transition: all 0.2s ease-in;
background-size: cover;
}
.sidebar {
height: 100%;
background: #eee;
transition: all 0.2s ease-in;
display: inline-block;
width: 100px;
transform: translateX(-100%);
position: absolute;
z-index: 999;
top: 0;
}
.overLay {
position: absolute;
background: rgba(0 , 0, 0, 0.5);
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 998;
transition: all 0.2s ease-in;
transform: scale(0.5,0.5);
opacity: 0;
}
.container:hover .sidebar {
transform: translateY(0);
opacity: 1;
}
.container:hover .overLay {
transform: scale(1,1);
opacity: 1;
}
.container:hover .main {
transform: translateX(100px);
background-size: cover;
}
img {
max-width: 100%;
}
</style>
</head>
<body>
<div class="container">
<div class="main"></div>
<div class="sidebar"></div>
<div class="overLay"></div>
</div>
<script id="jsbin-source-css" type="text/css">.container {
width: 360px;
margin: 0 auto;
height: 500px;
overflow: hidden;
position: relative;
}
.main {
background: url('http://immaceleb.com/wp-content/uploads/2014/10/Amber-Heard-Wallpaper-11.jpg');
width: 100%;
height: 100%;
transition: all 0.2s ease-in;
background-size: cover;
}
.sidebar {
height: 100%;
background: #eee;
transition: all 0.2s ease-in;
display: inline-block;
width: 100px;
transform: translateX(-100%);
position: absolute;
z-index: 999;
top: 0;
}
.overLay {
position: absolute;
background: rgba(0 , 0, 0, 0.5);
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 998;
transition: all 0.2s ease-in;
transform: scale(0.5,0.5);
opacity: 0;
}
.container:hover .sidebar {
transform: translateY(0);
opacity: 1;
}
.container:hover .overLay {
transform: scale(1,1);
opacity: 1;
}
.container:hover .main {
transform: translateX(100px);
background-size: cover;
}
img {
max-width: 100%;
}</script>
</body>
</html>
.container {
width: 360px;
margin: 0 auto;
height: 500px;
overflow: hidden;
position: relative;
}
.main {
background: url('http://immaceleb.com/wp-content/uploads/2014/10/Amber-Heard-Wallpaper-11.jpg');
width: 100%;
height: 100%;
transition: all 0.2s ease-in;
background-size: cover;
}
.sidebar {
height: 100%;
background: #eee;
transition: all 0.2s ease-in;
display: inline-block;
width: 100px;
transform: translateX(-100%);
position: absolute;
z-index: 999;
top: 0;
}
.overLay {
position: absolute;
background: rgba(0 , 0, 0, 0.5);
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 998;
transition: all 0.2s ease-in;
transform: scale(0.5,0.5);
opacity: 0;
}
.container:hover .sidebar {
transform: translateY(0);
opacity: 1;
}
.container:hover .overLay {
transform: scale(1,1);
opacity: 1;
}
.container:hover .main {
transform: translateX(100px);
background-size: cover;
}
img {
max-width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment