HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<header>
<nav class="main-menu">
<span class="logo">
<img src="">
</span>
<hgroup class="page-title">
<h1>Advent Calendar</h1>
</hgroup>
<ul class="menu">
<li class="about-link">About</li>
<li class="notes-link">Notes</li>
</ul>
</nav>
</header>
<section class="notes hidden">
<span class="close-notes">x</span>
<div class="about">
<p>Coming soon!</p>
</div>
<div class="design-notes">
<ol>
<li><a href="http://www.schillmania.com/projects/snowstorm/">Let</a> <a href="https://loktar00.github.io/JQuery-Snowfall/">it</a> <a href="https://www.madebymagnitude.com/blog/7-ideas-to-spice-up-your-website-this-christmas/">snow</a> <i class="fa fa-check" aria-hidden="true"></i></li>
<li><a href="http://color.adobe.com">Choose color palette</a> <i class="fa fa-check" aria-hidden="true"></i></li>
<li><del><a href="https://codepen.io/seanmccaffery/pen/xBpbG">Cool title hover effect?</a></del></li>
<li><a href="https://codepen.io/SitePoint/pen/dppJzX">Tilted Angled lines?</a></li>
<li><a href="http://demo.iprodev.com/christmas/">Cool Landing Page design</a></li>
<li>Make <a href="https://santatracker.google.com/village.html">vector</a> <a href="http://xmas.sitepoint.com/#day/1">background</a></li>
<li>Or, draw CSS Christmas shapes (presents) <i class="fa fa-check" aria-hidden="true"></i></li>
<li><a href="http://xmas.sitepoint.com/#day/1">Scroll</a> <a href="http://www.polishchristmasguide.com/">right</a> or pop out like PPT or <a href="http://pepsized.com/merry-scrolling-with-skrollr-js/">do something with scroll</a> <i class="fa fa-check" aria-hidden="true"></i> fix 5px error</li>
<li>When click present, it slides to the center and opens, click away, slides back in place and closes</li>
<li>Make each <a href="https://24ways.org/">section</a> open a <a href="http://uxmas.com/2016/a-miracle-at-christmas/">blog post</a></li>
<li>Use <a href="https://codepen.io/krogsgard/pen/NRBqPp">WP API</a> to load Posts</li>
<li>Create Christmas icons and <a href="https://github.com/alexk111/SVG-Morpheus">morph them</a></li>
</ol>
</div>
</section>
<main>
<aside class="countdown-clock">
<ul id="countdown">
<li id="days">
<div class="number">00</div>
<div class="label">Days</div>
<svg width="100" height="100" class="pie-plate">
<circle r="50" cx="50" cy="50" class="pie" />
</svg>
</li>
<li id="hours">
<div class="number">00</div>
<div class="label">Hours</div>
<svg width="100" height="100" class="pie-plate">
<circle r="50" cx="50" cy="50" class="pie" />
</svg>
</li>
<li id="minutes">
<div class="number">00</div>
<div class="label">Minutes</div>
<svg width="100" height="100" class="pie-plate">
<circle r="50" cx="50" cy="50" class="pie" stroke-dasharray="10"/>
</svg>
</li>
<li id="seconds">
<div class="number">00</div>
<div class="label">Seconds</div>
<svg width="100" height="100" class="pie-plate">
<circle r="50" cx="50" cy="50" class="pie" />
</svg>
</li>
</ul>
<p>Remaining 'til Christmas <span class="this-year"></span></p>
</aside>
<div class="controls">
<div class="prev">
<i class="fa fa-5x fa-angle-left"></i>
</div>
<div class="next">
<i class="fa fa-5x fa-angle-right"></i>
</div>
</div>
<div id="posts" id="notes">
<div class="close">X</div>
</div>
<div id="carousel">
<a id="day-1"></a>
<a id="day-2"></a>
<a id="day-3"></a>
<a id="day-4"></a>
<a id="day-5"></a>
<a id="day-6"></a>
<a id="day-7"></a>
<a id="day-8"></a>
<a id="day-9"></a>
<a id="day-10"></a>
<a id="day-11"></a>
<a id="day-12"></a>
<a id="day-13"></a>
<a id="day-14"></a>
<a id="day-15"></a>
<a id="day-16"></a>
<a id="day-17"></a>
<a id="day-18"></a>
<a id="day-19"></a>
<a id="day-20"></a>
<a id="day-21"></a>
<a id="day-22"></a>
<a id="day-23"></a>
<a id="day-24"></a>
<a id="day-25"></a>
<div id="container">
<div id="inner">
<section id="day1" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">1<span>st</span></h1>
<div class="tag">
<p class="tag-front">
To: <input type="text" value="Aaron"/>
<button>O</button>
</p>
<p class="tag-back">
From: <input type="text" value="Santa" />
<button>O</button>
</p>
</div>
</div>
</section>
<section id="day2" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">2<span>nd</span></h1>
</div>
</section>
<section id="day3" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">3<span>rd</span></h1>
</div>
</section>
<section id="day4" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">4<span>th</span></h1>
</div>
</section>
<section id="day5" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">5<span>th</span></h1>
</div>
</section>
<section id="day6" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">6<span>th</span></h1>
</div>
</section>
<section id="day7" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">7<span>th</span></h1>
</div>
</section>
<section id="day8" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">8<span>th</span></h1>
</div>
</section>
<section id="day9" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">9<span>th</span></h1>
</div>
</section>
<section id="day10" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">10<span>th</span></h1>
</div>
</section>
<section id="day11" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">11<span>th</span></h1>
</div>
</section>
<section id="day12" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">12<span>th</span></h1>
</div>
</section>
<section id="day13" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">13<span>th</span></h1>
</div>
</section>
<section id="day14" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">14<span>th</span></h1>
<div class="tag">
<p class="tag-front">
To: <input type="text" value="Aaron"/>
<button>O</button>
</p>
<p class="tag-back">
From: <input type="text" value="Santa" />
<button>O</button>
</p>
</div>
</div>
</section>
<section id="day15" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">15<span>th</span></h1>
<div class="tag">
<p class="tag-front">
To: <input type="text" value="Aaron"/>
<button>O</button>
</p>
<p class="tag-back">
From: <input type="text" value="Santa" />
<button>O</button>
</p>
</div>
</div>
</section>
<section id="day16" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">16<span>th</span></h1>
</div>
</section>
<section id="day17" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">17<span>th</span></h1>
</div>
</section>
<section id="day18" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">18<span>th</span></h1>
</div>
</section>
<section id="day19" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">19<span>th</span></h1>
</div>
</section>
<section id="day20" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">20<span>th</span></h1>
</div>
</section>
<section id="day21" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">21<span>st</span></h1>
</div>
</section>
<section id="day22" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">22<span>nd</span></h1>
</div>
</section>
<section id="day23" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">23<span>rd</span></h1>
</div>
</section>
<section id="day24" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">24<span>th</span></h1>
</div>
</section>
<section id="day25" class="day active">
<div class="present">
<span class="bow"></span>
<span class="ribbon"></span>
<h1 class="present-title">25<span>th</span></h1>
</div>
</section>
</div><!-- #inner -->
</div><!-- #container -->
</div><!-- #carousel -->
</main>
<footer>
<ul id="index" class="day-list">
<li class=""><a href="#day-1"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>1</span></a></li>
<li class=""><a href="#day-2"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>2</span></a></li>
<li class=""><a href="#day-3"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>3</span></a></li>
<li class=""><a href="#day-4"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>4</span></a></li>
<li class=""><a href="#day-5"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>5</span></a></li>
<li class=""><a href="#day-6"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>6</span></a></li>
<li class=""><a href="#day-7"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>7</span></a></li>
<li class=""><a href="#day-8"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>8</span></a></li>
<li class=""><a href="#day-9"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>9</span></a></li>
<li class=""><a href="#day-10"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>10</span></a></li>
<li class=""><a href="#day-11"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>11</span></a></li>
<li class=""><a href="#day-12"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>12</span></a></li>
<li class=""><a href="#day-13"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>13</span></a></li>
<li class=""><a href="#day-14"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>14</span></a></li>
<li class=""><a href="#day-15"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>15</span></a></li>
<li class=""><a href="#day-16"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>16</span></a></li>
<li class=""><a href="#day-17"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>17</span></a></li>
<li class=""><a href="#day-18"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>18</span></a></li>
<li class=""><a href="#day-19"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>19</span></a></li>
<li class=""><a href="#day-20"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>20</span></a></li>
<li class=""><a href="#day-21"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>21</span></a></li>
<li class=""><a href="#day-22"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>22</span></a></li>
<li class=""><a href="#day-23"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>23</span></a></li>
<li class=""><a href="#day-24"><i class="fa fa-3x fa-gift" aria-hidden="true"></i><span>24</span></a></li>
<li class="christmas"><a href="#day-25"><i class="fa fa-4x fa-gift" aria-hidden="true"></i><span>25</span></a></li>
</ul>
</footer>
/**
* Variables
*/
$color__light_blue: #CAE4F2;
$color__dark_blue: #2A6FB0; /* 42, 111, 176 */
$color__dark_blue_alpha: rgba(42,111,176,0.3);
$color__dark_blue_dark_alpha: rgba(42,111,176,0.8);
$color__dark_blue_darker_alpha: rgba(42,111,176,0.9);
$color__light_green: #65C0A5;
$color__dark_green: #0B8972; /* #35a66f
*/
$color__dark_green_alpha: #6DB8AA;
$color__light_red: #F17259;
$color__light_red_alpha: #F38E7A;
$color__dark_red: #9D1313;
$font_stack__body: 'Nunito', 'Quicksand', 'Valero Round', sans-serif;
$font_stack__headings: 'Sonsie One', cursive;
$section_height: 100vh;
$section_width: calc( 100vw + 17px );
$post_width: 600px;
/**
* General Styles
*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
position: relative;
}
body {
font-size: 16px;
background: $color__light_blue;
font-family: $font_stack__body;
font-weight: 100;
letter-spacing: -0.2px;
line-height: 1.6;
}
header {
background: white;
box-shadow: 0px 2px 2px $color__dark_blue_alpha;
z-index: 1000;
}
main{
}
main .day {
}
h1, h2, h3, h4, h5, h6 {
font-family: $font_stack__headings;
}
hgroup {
text-align: center;
}
a {
color: gray;
text-decoration: none;
border-bottom: 1px solid gray;
}
.fa-check {
color: $color__light_green;
}
.hidden {
display: none;
}
section.active,
div.active {
display: inline-block;
}
/**
* Top
*/
.main-menu {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: white;
padding: 1em;
margin-bottom: 2em;
// box-shadow: 2px 2px 5px $color__dark_blue;
}
.page-title {
font-size: 1.5em;
}
.logo {
position: absolute;
left: 1em;
top: 1em;
}
.menu {
list-style: none;
position: absolute;
right: 1em;
top: 0;
padding: 0 1em;
}
.menu li {
display: inline-block;
padding: 2em 1em;
max-height: 90px;
cursor: pointer;
}
.menu li.active,
.menu li:hover,
.menu li:active {
border-bottom: 3px solid black;
}
/* Controls */
.controls {
position: absolute;
height: 100vh;
width: 100%;
}
.controls .prev,
.controls .next {
position: absolute;
height: 100%;
line-height: calc( 100vh - 90px );
z-index: 10;
left: 0;
padding: 50px;
vertical-align: middle;
color: white;
text-shadow: 1px 0px 4px $color__dark_blue;
}
.controls .next {
text-align: right;
right: 0;
left: auto;
text-shadow: -1px 0px 4px $color__dark_blue;
}
/* @TODO this gradient on hover */
.controls .prev:hover {
cursor: pointer;
background: $color__dark_blue_alpha;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, left top, right top, from($color__dark_blue_alpha), to(transparent));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(left, $color__dark_blue_alpha, transparent);
/* Firefox 3.6+ */
background: -moz-linear-gradient(left, $color__dark_blue_alpha, transparent);
/* IE 10 */
background: -ms-linear-gradient(left, $color__dark_blue_alpha, transparent);
/* Opera 11.10+ */
background: -o-linear-gradient(left, $color__dark_blue_alpha, transparent);
}
.controls .next:hover {
cursor: pointer;
background: $color__dark_blue_alpha;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, right top, left top, from($color__dark_blue_alpha), to(transparent));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(right, $color__dark_blue_alpha, transparent);
/* Firefox 3.6+ */
background: -moz-linear-gradient(right, $color__dark_blue_alpha, transparent);
/* IE 10 */
background: -ms-linear-gradient(right, $color__dark_blue_alpha, transparent);
/* Opera 11.10+ */
background: -o-linear-gradient(right, $color__dark_blue_alpha, transparent);
}
section {
width: $section_width;
height: $section_height;
padding-top: 90px;
font-size: 1.1em;
}
.notes {
background: $color__dark_blue_alpha;
width: 100%;
height: $section_height;
margin: 0;
padding: 0;
z-index: 2000;
}
.design-notes,
.about {
background: white;
max-width: 600px;
padding: 0.5em;
margin: 0 auto;
box-shadow: 2px 2px 5px black;
position: relative;
top: 50%;
transform: translateY(-50%);
}
.design-notes ol,
.about p {
border: 2px solid black;
padding: 1em 1em 1em 2em;
}
.close-notes {
position: absolute;
left: 50%;
top: -50%;
transform: translateX(-50%);
font-size: 4em;
color: rgba(255,255,255,0.7);
font-family: 'Valera Round', sans-serif;
text-shadow: 1px 1px 5px black;
cursor: pointer;
}
/**
* Countdown Clock
*/
.countdown-clock {
width: 560px;
height: 120px;
position: absolute;
top: 120px;
left: 50%;
transform: translateX(-50%);
text-align: center;
color: $color__dark_blue;
opacity: 0.3;
border-top: 2px solid $color__dark_blue;
border-bottom: 2px solid $color__dark_blue;
}
.pie {
fill: transparent;
stroke: white;
stroke-width: 100;
stroke-dasharray: 0 100;
transition: stroke-dasharray .3s ease;
}
.pie-plate {
position: absolute;
top: -8px;
left: -20px;
z-index: -1;
background: transparent;
border-radius: 50%;
display: block;
transform: rotate(-90deg);
}
#countdown {
list-style: none;
margin-bottom: 1em;
}
#countdown li {
display: inline-block;
margin: 1em 2em;
position: relative;
}
#countdown .number {
font-size: 3em;
margin: 10px -12px 0; /* Negative left-right margins to account for 100+ number in the Days countdown */
padding: 0;
line-height: 1;
}
#countdown .label {
margin-top: -5px;
}
/**
* React Posts
*/
#posts {
margin: 0 auto;
position: absolute;
top: $section_height;
// left: 50%;
// transform: translate(-50%, -40%);
width: $section_width;
height: $section_height;
overflow: hidden;
background-color: $color__dark_red;
background-image:
repeating-linear-gradient(120deg, rgba(255,255,255,.1), rgba(255,255,255,.1) 2px, transparent 2px, transparent 120px),
repeating-linear-gradient(60deg, rgba(255,255,255,.1), rgba(255,255,255,.1) 2px, transparent 2px, transparent 120px),
linear-gradient(60deg, rgba(0,0,0,.1) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.1) 75%, rgba(0,0,0,.1)),
linear-gradient(120deg, rgba(0,0,0,.1) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.1) 75%, rgba(0,0,0,.1));
background-size: 138px 240px;
z-index: 1000;
transition: 0.3s ease-in all;
}
#posts .close-posts {
font-size: 3em;
font-weight: 100;
position: absolute;
top: 10px;
right: 40px;
color: $color__light_blue;
text-shadow: 1px 1px 3px $color__dark_blue;
}
#posts .close-posts:hover {
cursor: pointer;
text-shadow: 2px 2px 5px $color__dark_blue;
opacity: 0.8;
}
#posts .post-controls {
position: absolute;
top: 50%;
transform: translateY(-50%);
text-align: center;
}
#posts .post-prev,
#posts .post-next {
color: white;
background: $color__dark_blue;
width: 30px;
height: 50px;
display: block;
position: absolute;
transform: translateY(-50%);
padding: 0 10px;
left: -20px;
z-index: 10001;
}
#posts .post-next {
left: 580px;
}
#posts .post {
width: 600px;
box-sizing: border-box;
background: white;
margin: 50vh 50vw;
transform: translate(-50%, -50%);
display: inline-block;
padding: 5px;
display: hidden;
box-shadow: 2px 2px 5px $color__dark_blue;
}
#posts .post-inner {
padding: 2em 3em 1em;
border: 2px solid $color__dark_blue_alpha;
}
#posts .post:hover .post-inner {
border: 2px solid $color__dark_blue;
}
#posts .post-title a {
color: black;
text-decoration: none;
border: 0;
padding-bottom: 2em;
}
#posts .excerpt {
padding: 0.5em 0 1em;
}
#posts .entry-meta {
padding: 0 0 1.5em;
border: 0;
text-align: center;
}
#posts .author-wrap {
border: 0;
color: $color__dark_blue;
}
#posts .avatar {
padding-right: 0.5em;
}
#posts .button {
border: 0;
background: $color__dark_blue_dark_alpha;
color: white;
display: inline-block;
margin: 0 auto;
padding: 0.5em 1em;
border-radius: 5px;
opacity: 0.6;
}
#posts .button:hover {
background: $color__dark_blue;
opacity: 1;
}
/**
* Sections
*/
// .day {
// // width: 100vw;
// height: 100vh;
// overflow: hidden;
// box-sizing: border-box;
// }
.bow {
position: relative;
width: 212px;
height: 100px;
}
.bow:before,
.bow:after {
content: "";
position: absolute;
top: -60px;
left: 30px;
width: 60px;
height: 60px;
border-right: 25px solid $color__dark_green;
border-bottom: 25px solid $color__light_green;
border-top: 25px solid $color__light_green;
border-left: 25px solid $color__dark_green;
-moz-border-radius: 50px 150px 0 150px;
border-radius: 50px 150px 0 150px;
-webkit-transform: rotate(-35deg);
-moz-transform: rotate(-35deg);
-ms-transform: rotate(-35deg);
-o-transform: rotate(-35deg);
transform: rotate(-35deg);
}
.bow:after {
left: 160px;
right: 0;
-moz-border-radius: 150px 50px 150px 0;
border-radius: 150px 50px 150px 0;
-webkit-transform: rotate(35deg);
-moz-transform: rotate(35deg);
-ms-transform: rotate(35deg);
-o-transform: rotate(35deg);
transform: rotate(35deg);
}
.present {
width: 300px;
height: 300px;
background: $color__dark_red;
border-radius: 10px;
box-shadow: 2px 2px 5px $color__dark_blue;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
// transform: scale(1);
transition: 0.1s ease-in all;
}
.present:hover {
cursor: pointer;
transform: scale(1.1);
}
.present:before {
box-sizing: border-box;
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
height: 60px;
background: $color__light_green;
border-top: 15px solid $color__dark_green;
border-bottom: 15px solid $color__dark_green;
display: block;
}
.present:after {
box-sizing: border-box;
content: '';
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 60px;
height: 100%;
background: $color__light_green;
border-left: 15px solid $color__dark_green;
border-right: 15px solid $color__dark_green;
display: block;
}
.present h1 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
color: $color__dark_green;
text-align: center;
font-size: 2.5em;
line-height: 2;
letter-spacing: -2px;
z-index: 5;
background: white;
width: 100px;
height: 100px;
border-radius: 50%;
padding: 5px;
box-shadow: 2px 2px 5px rgba(60,60,60,1);
}
.present h1 span {
margin-left: -2px;
font-size: 0.25em;
}
.ribbon,
.present h1:before {
content: "";
display: block;
position: absolute;
z-index: 1;
width: 50px;
height: 50px;
background: $color__light_green;
border-radius: 50%;
top: -30px;
left: 50%;
transform: translateX(-50%);
}
.present h1:before {
top: -130px;
z-index: 2;
box-shadow: 1px 1px 3px $color__dark_green;
}
.ribbon:before,
.ribbon:after {
content: '';
display: block;
position: absolute;
height: 80px;
width: 0px;
// background: $color__dark_green;
top: 20px;
left: -30px;
border-right: 15px solid $color__light_green;
border-left: 15px solid $color__dark_green;
border-top: 15px solid $color__light_green;
border-bottom: 15px solid transparent;
-webkit-transform: rotate(35deg);
-moz-transform: rotate(35deg);
-ms-transform: rotate(35deg);
-o-transform: rotate(35deg);
transform: rotate(35deg);
}
.ribbon:after {
right: -30px;
left: auto;
-webkit-transform: rotate(-35deg);
-moz-transform: rotate(-35deg);
-ms-transform: rotate(-35deg);
-o-transform: rotate(-35deg);
transform: rotate(-35deg);
}
/**
* Carousel
*/
// #carousel {
// // width: 100vw;
// }
#container {
overflow: hidden;
// width: 100vw;
margin: 0;
padding: 0;
// box-sizing: border-box;
}
#inner {
transition: all 1s;
width: 25 * 100vw;
margin: 0;
padding: 0;
box-sizing: border-box;
}
// Scss for loop not working
// @for $i from 0 through 24 {
// .day-#{$i}:target ~ #container #inner {
// margin-left: -$i * 100%;
// }
// }
#day-1:target ~ #container #inner {
margin-left: 0vw;
}
#day-2:target ~ #container #inner {
margin-left: calc( -1 * 100vw );
}
#day-3:target ~ #container #inner {
margin-left: calc( -2 * 100vw );
}
#day-4:target ~ #container #inner {
margin-left: calc( -3 * 100vw );
}
#day-5:target ~ #container #inner {
margin-left: calc( -4 * 100vw );
}
#day-6:target ~ #container #inner {
margin-left: calc( -5 * 100vw );
}
#day-7:target ~ #container #inner {
margin-left: calc( -6 * 100vw );
}
#day-8:target ~ #container #inner {
margin-left: calc( -7 * 100vw );
}
#day-9:target ~ #container #inner {
margin-left: calc( -8 * 100vw );
}
#day-10:target ~ #container #inner {
margin-left: calc( -9 * 100vw );
}
#day-11:target ~ #container #inner {
margin-left: calc( -10 * 100vw );
}
#day-12:target ~ #container #inner {
margin-left: calc( -11 * 100vw );
}
#day-13:target ~ #container #inner {
margin-left: calc( -12 * 100vw );
}
#day-14:target ~ #container #inner {
margin-left: calc( -13 * 100vw );
}
#day-15:target ~ #container #inner {
margin-left: calc( -14 * 100vw );
}
#day-16:target ~ #container #inner {
margin-left: calc( -15 * 100vw );
}
#day-17:target ~ #container #inner {
margin-left: calc( -16 * 100vw );
}
#day-18:target ~ #container #inner {
margin-left: calc( -17 * 100vw );
}
#day-19:target ~ #container #inner {
margin-left: calc( -18 * 100vw );
}
#day-20:target ~ #container #inner {
margin-left: calc( -19 * 100vw );
}
#day-21:target ~ #container #inner {
margin-left: calc( -20 * 100vw );
}
#day-22:target ~ #container #inner {
margin-left: calc( -21 * 100vw );
}
#day-23:target ~ #container #inner {
margin-left: calc( -22 * 100vw );
}
#day-24:target ~ #container #inner {
margin-left: calc( -23 * 100vw );
}
#day-25:target ~ #container #inner {
margin-left: calc( -24 * 100vw );
}
/**
* Footer
*/
footer {
background: white;
box-shadow: 0px -2px 15px $color__dark_blue_alpha;
width: 100%;
min-height: 90px;
text-align: center;
position: fixed;
bottom: 0;
z-index: 100;
}
.fa-gift {
color: $color__dark_green_alpha;
}
.day-list {
margin: 0 auto;
}
.day-list li {
display: inline-block;
margin: 0.25em;
}
.day-list li:hover {
cursor: pointer;
}
.day-list a {
text-decoration: none;
border-bottom: 0;
margin: 0;
padding: 0;
}
.day-list li span {
background: $color__light_red_alpha;
color: white;
text-align: center;
width: 14px;
height: 24px;
font-family: $font_stack__headings;
font-size: 0.9em;
position: absolute;
top: -1px;
left: 50%;
transform: translate( -50%, -30% );
z-index: 30;
}
.day-list .christmas span {
height: 33px;
font-size: 1.2em;
top: -7px;
}
.today .fa-gift,
.day-list li:hover .fa-gift {
color: $color__dark_green;
text-shadow: 0px -2px 2px $color__light_blue;
transform: scale(1.1);
}
.day-list .today span,
.day-list li:hover span {
background: $color__light_red;
height: 26px;
font-size: 1em;
}
.day-list .today span:before,
.day-list li:hover span:before {
font-family: 'FontAwesome';
content: '\f063';
position: absolute;
top: -60px;
color: $color__dark_red;
font-size: 2em;
left: 50%;
transform: translateX(-50%);
}
.day-list .christmas:hover span {
opacity: 1;
height: 36px;
font-size: 1.3em;
}
.day-list .christmas:hover span:before {
top: -75px;
}
.day-list .disabled i,
.day-list .disabled:hover i {
color: gainsboro;
}
.day-list li.disabled:hover .fa-gift {
transform: scale(1);
text-shadow: none;
}
.day-list .disabled span,
.day-list .disabled:hover span {
background: silver;
font-size: 0.9em;
width: 14px;
height: 24px;
}
.day-list .disabled:hover span:before {
display: none;
}
@media screen and (max-width: 1025px) {
.page-title {
font-size: 1em;
}
.menu li {
padding: 1.5em 1em;
max-height: 70px;
}
footer {
min-height: 50px;
}
.day-list li {
font-size: 50%;
}
.day-list li span {
width: 6px;
height: 13px;
top: 1px;
}
.day-list li:hover span {
height: 14px;
}
.day-list .christmas span {
height: 16px;
width: 8px;
top: -1px;
}
.day-list .christmas:hover span {
height: 18px;
width: 9px;
top: -2px;
}
.day-list .today span:before,
.day-list li:hover span:before {
top: -25px;
}
.day-list .christmas:hover span:before {
top: -35px;
}
}
/**
* CSS Styles for the Gift Tag
*/
@import url('https://fonts.googleapis.com/css?family=Satisfy|Yellowtail');
.tag {
display: block;
border-right: 50px solid transparent;
background: tan;
height: 90px;
width: 100px;
max-width: 200px;
font-family: Satisfy;
position: absolute;
top: 25px;
right: -60px;
transform: rotate(30deg);
}
.tag:before {
border-right: 45px solid tan;
border-top: 45px solid transparent;
border-left: 45px solid transparent;
border-bottom: 45px solid transparent;
position: absolute;
top: 0;
left: -90px;
content: '';
display: block;
}
.tag:after {
border-right: 45px solid transparent;
border-top: 45px solid tan;
border-left: 45px solid tan;
border-bottom: 45px solid tan;
position: absolute;
top: 0;
right: -140px;
content: '';
display: block;
}
.tag p {
position: absolute;
border-top: 3px solid brown;
border-bottom: 3px solid brown;
height: 80px;
width: 188px;
left: -5px;
top: 5px;
padding: 1em 50px 1em 15px;
}
.tag input {
background: transparent;
font-family: Satisfy;
font-size: 1.5em;
width: 100px;
outline: none;
border: none;
}
.tag button {
position: absolute;
top: 25px;
left: -30px;
font-size: 1.2em;
background: transparent;
outline: none;
border: none;
}
.tag button:before {
position: absolute;
top: -5px;
left: -90px;
z-index: 1;
display: block;
content: '';
border-radius: 50%;
width: 110px;
height: 110px;
border-top: 3px solid gold;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 3px solid transparent;
}
.tag li:hover {
cursor: pointer;
}
.tag li:hover .tag-front {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-transform: perspective(1000) rotateY(180deg);
-moz-transform: perspective(1000) rotateY(180deg);
-ms-transform: perspective(1000) rotateY(180deg);
-o-transform: perspective(1000) rotateY(180deg);
transform: perspective(1000) rotateY(180deg);
}
.tag li:hover .tag-back {
z-index: 950;
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg);
-webkit-transform: perspective(1000) rotateY(0deg);
-moz-transform: perspective(1000) rotateY(0deg);
-ms-transform: perspective(1000) rotateY(0deg);
-o-transform: perspective(1000) rotateY(0deg);
transform: perspective(1000) rotateY(0deg);
}
.tag .tag-front,
.tag .tag-back {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 0.6s;
-moz-transition: -moz-transform 0.6s;
-o-transition: -o-transform 0.6s;
transition: transform 0.6s;
display: block;
// height: 100%;
position: absolute;
// width: 100%;
}
.tag .tag-front {
-webkit-transform: perspective(1000) rotateY(0);
-moz-transform: perspective(1000) rotateY(0);
-ms-transform: perspective(1000) rotateY(0);
-o-transform: perspective(1000) rotateY(0);
transform: perspective(1000) rotateY(0);
z-index: 900;
}
.tag .tag-back {
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
transform: rotateY(-180deg);
z-index: 800;
}
/**
* Let it snow!!
*/
$.fn.snow();
var winHeight = $(document).height();
var winWidth = $(document).width();
/**
* Show Posts
*/
$('.present').click( function() {
$('#posts').css({"top": 0});
});
$('#posts').click( function() {
$('#posts').css({"top": winHeight + 'px'});
});
/**
* Navigation menu and notes
*/
$('.about-link, .notes-link').click( function() {
$('.notes').addClass('active').removeClass('hidden');
if( $(this).attr('class') === 'about-link') {
$('.about').addClass('active').removeClass('hidden');
} else if( $(this).attr('class') === 'notes-link') {
$('.design-notes').addClass('active').removeClass('hidden');
}
});
$('section, .close-notes').click( function() {
$('.notes, .about, .design-notes').removeClass('active').addClass('hidden');
});
/* Prev/Next Buttons */
$('.day-list li').click( function() {
$('.day-list li').removeClass('active').removeClass('today');
$(this).addClass('active');
});
// Prev button
$('.prev').click( function() {
var pos = $('#container #inner').css("margin-left");
pos = pos.slice(0,-2);
if( pos === '0' ) {
$('#container #inner').css("margin-left", "-2400vw");
} else {
var offset = parseInt(pos) + winWidth;
$('#container #inner').css("margin-left", offset + "px" );
}
});
// Next button
$('.next').click( function() {
var pos = $('#container #inner').css("margin-left");
pos = pos.slice(0,-2);
if( pos >= width * 25 ) {
$('#container #inner').css("margin-left", "-0vw");
} else {
var offset = parseInt(pos) - winWidth;
$('#container #inner').css("margin-left", offset + "px" );
}
});
/**
* Date Countdown timer
* @link https://codepen.io/chrisjdesigner/pen/dMbmoE
*/
var thisYear = new Date();
var thisChristmas = thisYear.getFullYear() + "/12/25 00:00:00";
var christmas = new Date( thisChristmas ),
days, hours, mins, secs;
$('.this-year').text( thisYear.getFullYear() );
//var setPieChart = function(name) {
//var num = name,
// fixedNumber = num,
// result = fixedNum + ' ' + total;
// pie.style.strokeDasharray = 25;
//}
function showToday() {
var date = thisYear.getDate();
// var date = 2;
$('.day-list li:nth-child(' + date + ')').addClass('today');
$('#container #inner').css({"margin-left": -(date-1) * winWidth + "px"});
var fgifts = $( '.day-list li' );
$.each( fgifts, function( i, obj ) {
if( i+1 <= date ) $(this).removeClass('disabled');
if( i+1 == date ) $(this).addClass( 'today' );
if( i+1 > date ) { $(this).addClass('disabled');
$(this).unbind('click');
}
});
$('#posts .post').css({"display":"none"});
$('#posts .post:nth-child(' + date + ')').css({"display":"block"});
}
$( '.disabled' ).click( function(e) {
e.preventDefault();
alert( 'Cheatin\' huh?' );
});
$(function() {
// Calculate time to Christmas
showToday();
timeToXmas();
// Transition from 0
numberTrans( '#days .number', days, 1000, 'easeOutQuad' );
numberTrans( '#hours .number', hours, 1000, 'easeOutQuad' );
numberTrans( '#minutes .number', mins, 1000, 'easeOutQuad' );
numberTrans( '#seconds .number', secs, 1000, 'easeOutQuad' );
// Begin countdown
setTimeout( countdownTimer, 1001 );
});
// function to calc Time to Christmas
function timeToXmas() {
var today = new Date();
// diff between dates
var diff = (today - christmas)/1000;
var diff = Math.abs(Math.floor(diff));
// Day to target
days = Math.floor(diff/(24*60*60));
secs = diff - days * 24*60*60;
// Hours
hours = Math.floor(secs/(60*60));
secs = secs - hours * 60*60;
// Minutes
mins = Math.floor(secs/60);
secs = secs - mins * 60;
}
// function to display the countdown Timer
function countdownTimer() {
timeToXmas();
// display in front-end clock
// Seems like multiplying by 360(degrees) gives an inaccurate measure - 315 is the proper number to be an even division of the pie graph clock
$( '#days .number' ).text(days);
var dayResult = 315*(days/25) + ' ' + 360;
$( '#days .pie' ).css( { "stroke-dasharray": dayResult } );
$( '#hours .number' ).text(hours);
var hrResult = 315*(hours/24) + ' ' + 360;
$( '#hours .pie' ).css( { "stroke-dasharray": hrResult } );
$( '#minutes .number' ).text(mins);
var minResult = 315*(mins/60) + ' ' + 360;
$( '#minutes .pie' ).css( { "stroke-dasharray": minResult } );
$( '#seconds .number' ).text(secs);
var secResult = 315*(secs/60) + ' ' + 360;
$( '#seconds .pie' ).css( { "stroke-dasharray": secResult } );
// repeat every second
setTimeout(countdownTimer, 1000);
}
// Transition numbers
function numberTrans( id, endpt, transDur, transEase ) {
$({numberCount: $(id).text()}).animate({numberCount: endpt}, {
duration: transDur,
easing: transEase,
step: function() {
$(id).text(Math.floor(this.numberCount));
},
complete: function() {
$(id).text(this.numberCount);
}
});
};
/**
* REACT app with WP API
* @link http://mediatemple.net/blog/tips/loading-and-using-external-data-in-react/
* @link https://codepen.io/krogsgard/pen/NRBqPp
*/
var Advent = React.createClass({
// Set the initial React state
getInitialState: function() {
return {
posts: [] // our data setup is expecting Posts
}
},
componentDidMount: function() {
var _th = this;
this.serverRequest =
axios
.get(this.props.source)
.then(function(result) {
_th.setState({
posts: result.data
});
});
},
// Error handling - if Ajax request is still going when React (or you) remove a component, abort Ajax request
componentWillUnmount: function() {
this.serverRequest.abort();
},
// Render our component!!
render: function() {
return (
<div className="post-wrapper">
<div className="close-posts">X</div>
{this.state.posts.map(function(post) {
return (
<div key={post.link} className="post">
<div className="post-controls">
<span className="post-prev"><i className="fa fa-3x fa-angle-left"></i></span>
<span className="post-next"><i className="fa fa-3x fa-angle-right"></i></span>
</div>
<div className="post-inner">
<a className="author-wrap" href={post._embedded.author[0].link}><img className="avatar" src={post._embedded.author[0].avatar_urls['48']} />posted by {post._embedded.author[0].name}</a>
<h2 className="post-title"><a href={post.link}
dangerouslySetInnerHTML={{__html:post.title.rendered}}
/></h2>
{ /* post.featured_media ?
<a href={post.link}><img src={post._embedded['wp:featuredmedia'][0].media_details.sizes["large"].source_url} /></a>
: null */}
{post.excerpt.rendered ?
<div className="excerpt" dangerouslySetInnerHTML={{__html:post.excerpt.rendered}} />
: null}
<div className="entry-meta">
<a className="button read-more" href={post.link}>Read More »</a>
</div>
</div>
</div>
);
})}
</div>
)
}
});
React.render(
<Advent source="https://aaronsnowberger.com/wp-json/wp/v2/posts/?_embed&categories=764&per_page=25&author=1" />,
document.querySelector("#posts")
);
Also see: Tab Triggers