JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<div class="row">
<div class="example-1 card">
<div class="wrapper">
<div class="date">
<span class="day">12</span>
<span class="month">Aug</span>
<span class="year">2016</span>
</div>
<div class="data">
<div class="content">
<span class="author">Jane Doe</span>
<h1 class="title"><a href="#">Boxing icon has the will for a couple more fights</a></h1>
<p class="text">The highly anticipated world championship fight will take place at 10am and is the second major boxing blockbuster in the nation after 43 years.</p>
<label for="show-menu" class="menu-button"><span></span></label>
</div>
<input type="checkbox" id="show-menu" />
<ul class="menu-content">
<li>
<a href="#" class="fa fa-bookmark-o"></a>
</li>
<li><a href="#" class="fa fa-heart-o"><span>47</span></a></li>
<li><a href="#" class="fa fa-comment-o"><span>8</span></a></li>
</ul>
</div>
</div>
</div>
<div class="example-2 card">
<div class="wrapper">
<div class="header">
<div class="date">
<span class="day">12</span>
<span class="month">Aug</span>
<span class="year">2016</span>
</div>
<ul class="menu-content">
<li>
<a href="#" class="fa fa-bookmark-o"></a>
</li>
<li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
<li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
</ul>
</div>
<div class="data">
<div class="content">
<span class="author">Jane Doe</span>
<h1 class="title"><a href="#">Stranger Things: The sound of the Upside Down</a></h1>
<p class="text">The antsy bingers of Netflix will eagerly anticipate the digital release of the Survive soundtrack, out today.</p>
<a href="#" class="button">Read more</a>
</div>
</div>
</div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
// Variables
$regal-blue: #034378;
$san-juan: #2d4e68;
$bermuda: #77d7b9;
$white: #fff;
$black: #000;
$open-sans: 'Open Sans',
sans-serif;
// clear-fix mixin
@mixin cf {
&::before,
&::after {
content: '';
display: table;
}
&::after {
clear: both;
}
}
* {
box-sizing: border-box;
}
body {
background-image: linear-gradient(to right, $regal-blue, $san-juan);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 100vh;
font-family: $open-sans;
}
a {
text-decoration: none;
}
h1 {
font-family: $open-sans;
font-weight: 300;
}
.row {
max-width: 900px;
margin: 50px auto 0;
}
// Base styles
.card {
float: left;
padding: 0 1.7rem;
width: 50%;
.menu-content {
@include cf;
margin: 0;
padding: 0;
list-style-type: none;
li {
display: inline-block;
}
a {
color: $white;
}
span {
position: absolute;
left: 50%;
top: 0;
font-size: 10px;
font-weight: 700;
font-family: 'Open Sans';
transform: translate(-50%, 0);
}
}
.wrapper {
background-color: $white;
min-height: 540px;
position: relative;
overflow: hidden;
box-shadow: 0 19px 38px rgba($black, 0.3), 0 15px 12px rgba($black, 0.2);
&:hover {
.data {
transform: translateY(0);
}
}
}
.data {
position: absolute;
bottom: 0;
width: 100%;
transform: translateY(calc(70px + 1em));
transition: transform 0.3s;
.content {
padding: 1em;
position: relative;
z-index: 1;
}
}
.author {
font-size: 12px;
}
.title {
margin-top: 10px;
}
.text {
height: 70px;
margin: 0;
}
input[type='checkbox'] {
display: none;
}
input[type='checkbox']:checked + .menu-content {
transform: translateY(-60px);
}
}
// First example styles
.example-1 {
.wrapper {
background: url(https://images.unsplash.com/photo-1496979551903-46e46589a88b?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=cda12b505afa1beb06e49d89014cbd65&auto=format&fit=crop&w=634&q=80) 20% 1% / cover no-repeat;
}
.date {
position: absolute;
top: 0;
left: 0;
background-color: $bermuda;
color: $white;
padding: 0.8em;
span {
display: block;
text-align: center;
}
.day {
font-weight: 700;
font-size: 24px;
text-shadow: 2px 3px 2px rgba($black, 0.18);
}
.month {
text-transform: uppercase;
}
.month,
.year {
font-size: 12px;
}
}
.content {
background-color: $white;
box-shadow: 0 5px 30px 10px rgba($black, 0.3);
}
.title {
a {
color: lighten($black, 50%);
}
}
.menu-button {
position: absolute;
z-index: 999;
top: 16px;
right: 16px;
width: 25px;
text-align: center;
cursor: pointer;
span {
width: 5px;
height: 5px;
background-color: lighten($black, 50%);
color: lighten($black, 50%);
position: relative;
display: inline-block;
border-radius: 50%;
&::after,
&::before {
content: '';
display: block;
width: 5px;
height: 5px;
background-color: currentColor;
position: absolute;
border-radius: 50%;
}
&::before {
left: -10px;
}
&::after {
right: -10px;
}
}
}
.menu-content {
text-align: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
transition: transform 0.3s;
transform: translateY(0);
li {
width: 33.333333%;
float: left;
background-color: $bermuda;
height: 60px;
position: relative;
}
a {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
}
span {
top: -10px;
}
}
}
// Second example styles
.example-2 {
.wrapper {
background: url(https://tvseriescritic.files.wordpress.com/2016/10/stranger-things-bicycle-lights-children.jpg) center / cover no-repeat;
&:hover {
.menu-content {
span {
transform: translate(-50%, -10px);
opacity: 1;
}
}
}
}
.header {
@include cf;
color: $white;
padding: 1em;
.date {
float: left;
font-size: 12px;
}
}
.menu-content {
float: right;
li {
margin: 0 5px;
position: relative;
}
span {
transition: all 0.3s;
opacity: 0;
}
}
.data {
color: $white;
transform: translateY(calc(70px + 4em));
}
.title {
a {
color: $white;
}
}
.button {
display: block;
width: 100px;
margin: 2em auto 1em;
text-align: center;
font-size: 12px;
color: $white;
line-height: 1;
position: relative;
font-weight: 700;
&::after {
content: '\2192';
opacity: 0;
position: absolute;
right: 0;
top: 50%;
transform: translate(0, -50%);
transition: all 0.3s;
}
&:hover {
&::after {
transform: translate(5px, -50%);
opacity: 1;
}
}
}
}
Also see: Tab Triggers