A Pen by The Rye Agency on CodePen.
-
-
Save tristanbailey/7c1a978c2edf1a4279218a47e9f30bb0 to your computer and use it in GitHub Desktop.
Scroll up box
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
<html> | |
<head> | |
</head> | |
<body> | |
<div class="overlay"> | |
<a href="#" class="overlay__title">Little teaser about the content</a> | |
<div class="overlay__content"> | |
<div class="overlay__inner"> | |
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | |
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | |
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
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
$(function() { | |
$('.overlay__title').click(function(e) { | |
e.preventDefault(); | |
$('.overlay').toggleClass('overlay--active'); | |
}); | |
}); |
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
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> |
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
/* compiled css */ | |
@charset "UTF-8"; | |
body { | |
font-family: sans-serif; | |
} | |
* { | |
box-sizing: border-box; | |
} | |
.overlay { | |
position: fixed; | |
bottom: 0; | |
right: 20px; | |
width: 300px; | |
border: #7736B0 3px solid; | |
border-bottom: 0; | |
border-radius: 4px 4px 0 0; | |
box-shadow: rgba(0, 0, 0, 0.2) 0 -2px 20px; | |
/* Small Screens */ | |
} | |
.overlay__title { | |
text-decoration: none; | |
display: block; | |
background: #7736B0; | |
color: #fff; | |
padding: 15px; | |
position: relative; | |
} | |
.overlay__title::after { | |
content: "➜"; | |
position: absolute; | |
transform: rotate(-90deg); | |
top: 15px; | |
right: 15px; | |
transition: all 0.3s ease-in-out; | |
} | |
.overlay--active .overlay__title::after { | |
transform: rotate(90deg); | |
} | |
.overlay__content { | |
height: 0px; | |
overflow: hidden; | |
transition: height 0.3s ease-in-out; | |
} | |
.overlay--active .overlay__content { | |
height: 300px; | |
} | |
.overlay__inner { | |
padding: 15px; | |
height: 100%; | |
overflow: scroll; | |
} | |
@media only screen and (max-width: 736px) { | |
.overlay { | |
width: 100%; | |
right: 0; | |
border-radius: 0; | |
} | |
.overlay--active .overlay__content { | |
height: 80vh; | |
} | |
} |
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
$colour: #7736B0; | |
$padding: 15px; | |
body { | |
font-family: sans-serif; | |
} | |
* { | |
box-sizing: border-box; | |
} | |
.overlay { | |
position: fixed; | |
bottom: 0; | |
right: 20px; | |
width: 300px; | |
border: $colour 3px solid; | |
border-bottom: 0; | |
border-radius: 4px 4px 0 0; | |
box-shadow: rgba(0,0,0,0.2) 0 -2px 20px; | |
&__title { | |
text-decoration: none; | |
display: block; | |
background: $colour; | |
color: #fff; | |
padding: $padding; | |
position: relative; | |
&::after { | |
content: "➜"; | |
position: absolute; | |
transform: rotate(-90deg); | |
top: $padding; | |
right: $padding; | |
transition: all 0.3s ease-in-out; | |
} | |
.overlay--active &::after { | |
transform: rotate(90deg); | |
} | |
} | |
&__content { | |
height: 0px; | |
overflow: hidden; | |
transition: height 0.3s ease-in-out; | |
.overlay--active & { | |
height: 300px; | |
} | |
} | |
&__inner { | |
padding: $padding; | |
height: 100%; | |
overflow: scroll; | |
} | |
/* Small Screens */ | |
@media only screen and (max-width: 736px) { | |
width: 100%; | |
right: 0; | |
border-radius: 0; | |
&--active .overlay__content { | |
height: 80vh; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A small scroll up box for bottom right of web page to allow for building own drip or contact email forms.
http://codepen.io/tristanbailey/details/BKPqMP/