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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<div class="yellow">
<div id="calendar">
<div id="toolbar"></div>
<div id="color-picker" class="show"></div>
<div id="dates" class="show">
<div id="lastMt">‹</div>
<div id="nextMt">›</div>
<div id="months-cont">
<div id="months">
<span class="active month">January</span><span class="month">February</span><span class="month">March</span><span class="month">April</span><span class="month">May</span><span class="month">June</span><span class="month">July</span><span class="month">August</span><span class="month">September</span><span class="month">October</span><span class="month">November</span><span class="month">December</span>
</div>
</div>
<div id="daysotweek">
<div class="day">S</div>
<div class="day">M</div>
<div class="day">T</div>
<div class="day">W</div>
<div class="day">T</div>
<div class="day">F</div>
<div class="day">S</div>
</div>
<div id="days">
</div>
</div>
<div id="info" class="hide">
<div id="actual-date"></div>
<div id="back"><</div>
<div id="month-name"></div>
<div id="weather">
<div id="sun"></div>
<div id="mountains"></div>
<div id="rain">
<div class="raindrop" id="drop-1"></div>
<div class="raindrop center" id="drop-2"></div>
<div class="raindrop center" id="drop-3"></div>
<div class="raindrop" id="drop-4"></div>
</div>
<div id="temp">57°<span>F</span></div>
</div>
<div id="bg-card">
<div class="content"></div>
</div>
<div id="card">
<div class="content">
<div id="event-name"></div>
<div id="event-details">
<div class="col-3">
<i class="fa fa-map-marker" aria-hidden="true"></i>
<h3>Location</h3>
<p>12345 Generic Ave., Some City, Some State, 12345
</div>
<div class="col-3">
<i class="fa fa-clock-o" aria-hidden="true"></i>
<h3>Time</h3>
<p> 12:00 AM </p>
</div>
<div class="col-3">
<i class="fa fa-user" aria-hidden="true"></i>
<h3>Attendee</h3>
<p>Me, You, and 2+</p>
</div>
<div style="clear: both"></div>
</div>
</div>
</div>
</div>
<div id="colors" class="hide">
<div id="close">×</div>
<p>Choose theme color</p>
<div class="color" id="salmon"></div>
<div class="color" id="dkpink"></div>
<div class="color" id="red"></div>
<div class="color" id="redorg"></div>
<div class="color" id="orange"></div>
<div class="color" id="orgylw"></div>
<div class="color active" id="yellow"></div>
<div class="color" id="green"></div>
<div class="color" id="aqua"></div>
<div class="color" id="teal"></div>
<div class="color" id="sltbl"></div>
<div class="color" id="pwdbl"></div>
<div class="color" id="blue"></div>
<div class="color" id="purple"></div>
<div class="color" id="dkprpl"></div>
</div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);
$salmon: #FB5965;
$dkpink: #E21C71;
$red: #E21C20;
$redorg: #EF4100;
$orange: #F76500;
$orgylw: #F77900;
$yellow: #FCEE6D;
$green: #8ABE30;
$aqua: #49E7D7;
$teal: #24A69E;
$sltbl: #288ED3;
$pwdbl: #2E73FF;
$blue: #1636E1;
$purple: #953CFE;
$dkprpl: #6100D6;
$gray: #626972;
$dkgray: #29323F;
$lavender: #838ECF;
@mixin hideOrShow($initVal, $finVal){
@-webkit-keyframes hideOrShow{
0% {
display: $initVal
}
100% {
display: $finVal;
}
}
@keyframes hideOrShow{
0% {
display: $initVal
}
100% {
display: $finVal;
}
}
&{
animation: hideOrShow 0.1s linear 2s forwards;
}
}
@mixin stagger-fadein($i, $timer, $max) {
@-webkit-keyframes fadeIn {
0% {
opacity: 0;
transform: scale(0);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes fadeIn {
0% {
opacity: 0;
transform: scale(0);
}
100% {
opacity: 1;
transform: scale(1);
}
}
$i: 0;
$timer: 0.2;
@while $i < $max {
&:nth-child(#{$i}){
animation: fadeIn 0.1s linear #{$timer}s forwards;
}
$i: $i + 1;
$timer: $timer + 0.05;
}
}
@mixin raindrop($i, $timer) {
i: 1;
$timer: 2;
@keyframes rain {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes rain {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@while $i < 5 {
&#drop-#{$i}{
animation: rain 0.1s linear #{$timer}s forwards;
}
$i: $i + 1;
$timer: $timer + 0.05;
}
}
@keyframes flipUp {
0% {
transform: rotateX(-90deg);
}
100% {
transform: rotateX(0deg);
}
}
* {
box-sizing: border-box;
outline: 0;
}
html, body{
height: 100%;
margin: 0;
}
@each $name, $color in (salmon, $salmon), (dkpink, $dkpink), (red, $red), (redorg, $redorg), (orange, $orange), (orgylw, $orgylw), (yellow, $yellow), (green, $green), (aqua, $aqua), (teal, $teal), (sltbl, $sltbl), (pwdbl, $pwdbl), (blue, $blue), (purple, $purple), (dkprpl, $dkprpl) {
.#{$name}, .prev-.#{$name}{
font-family: 'Monserrat', sans-serif;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: $color;
&.#{$name}{
background: $color;
transition: all 0.2s ease-in-out;
}
#calendar {
width: 16.5em;
min-height: 18em;
padding-bottom: 1.25em;
height: auto;
background: $dkgray;
color: #FFF;
position: relative;
box-shadow: 3px 3px 15px 0px rgba($dkgray, 0.75);
margin-left: 50%;
margin-top: 5vw;
transform: translateX(-50%);
-webkit-user-select: none;
user-select: none;
.input {
a {
display: block;
top: 0;
left: 0;
position: absolute;
padding: 1em 1.5em;
width: 100%;
background-size: 200% 100%;
background-image: linear-gradient(to left, $color 50%, transparent 50%);
transition: background-position .1s ease-in-out;
&:hover {
cursor: pointer;
background-position: 100% 0;
// color: $color;
}
}
}
.has-event {
&:after{
content: '';
display: block;
position: absolute;
left: 50%;
top: 50%;
border-radius: 50%;
border: 0.1em solid $color;
height: 1.4em;
width: 1.4em;
margin-left: -0.8em;
margin-top: -0.8em;
}
&.expanded {
color: $dkgray;
&:hover {
color: $dkgray!important;
}
&:after{
background: $color;
border-radius: 50%;
z-index: -1;
}
}
}
#color-picker {
background: $color;
width: 0.65em;
height: 0.65em;
position: absolute;
top: 1em;
left: 1em;
border-radius: 50%;
z-index: 10;
font-weight: 700;
&:hover {
cursor: pointer;
}
}
#dates {
padding: 1em 1.5em 0;
// position: absolute;
// top: 0;
// left: 0;
position: relative;
width: 100%;
#days {
.day {
@include stagger-fadein(1, 1, 40);
opacity: 0;
&:hover {
color: $color;
cursor: pointer;
}
}
}
}
#lastMt, #nextMt {
color: $gray;
position: absolute;
top: 1.45em;
font-weight: 700;
font-size: 1.25em;
z-index: 3;
&:hover {
cursor: pointer;
}
}
#lastMt {
left: 3.25em;
}
#nextMt {
right: 3.25em;
}
#months-cont {
width: 50%;
overflow: hidden;
height: 3em;
left: 50%;
margin-left: -25%;
position: relative;
#months {
height: 100%;
white-space: nowrap;
padding-top: 1em;
position: absolute;
top: 0;
left: 0;
width: 100%;
.month {
width: 100%;
font-size: 0.75em;
text-transform: uppercase;
color: $color;
display: inline-block;
text-align: center;
&:first-child{
transition: all 0.5s ease-in-out;
}
}
}
}
#days, #daysotweek {
.day {
width: calc(100%/7);
text-align: center;
float: left;
padding: 0.5em 0;
font-size: 0.8em;
position: relative;
transition:all 0.1s ease-in;
}
}
#daysotweek {
margin-top: 0.75em;
}
}
#info #actual-date {
text-align: center;
float: left;
padding: 0.5em 0;
font-size: 0.8em;
background: $color;
color: $dkgray;
height: 1.5em;
width: 1.5em;
line-height: .5em;
text-align: center;
border-radius: 50%;
position: absolute;
}
}
#colors {
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: 1.5em;
#close {
color: $gray;
position: absolute;
top: 0.5em;
right: 1em;
&:hover {
cursor: pointer;
}
}
&.show .color {
border-radius: 50%;
position: relative;
float: left;
opacity: 0;
width: 14%;
padding-bottom: 14%;
margin: 3%;
&##{$name}{
@include stagger-fadein(10, 0, 20);
background: $color;
transform-origin: center;
}
&.active {
box-shadow: 0 0 0 3px #FFF inset;
}
&:hover {
cursor: pointer;
}
}
}
#info {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
&.show {
#card .content{
animation: flipUp 0.2s linear 0.9s forwards;
}
#bg-card .content {
animation: flipUp 0.2s linear 0.6s forwards;
}
#rain .raindrop {
@include raindrop(1, 1);
}
}
#back {
color: $gray;
position: absolute;
top: 1em;
left: 1em;
}
#weather {
width: 88%;
left: 50%;
margin-left: -44%;
position: relative;
top: 2em;
#sun{
width: 0.75em;
height: 0.75em;
background: $yellow;
transform: rotate(45deg);
position: absolute;
left: 5.8em;
top: 1.8em;
&:after {
content: '';
display: block;
width: 0.75em;
height: 0.75em;
background: gold;
position: absolute;
left: 0;
transform: rotate(-45deg);
}
}
#rain {
position: absolute;
top: 3.8em;
width: 11%;
left: 50%;
margin-left: -18.1%;
text-align: center;
.raindrop {
opacity: 0;
width: 0.35em;
height: 0.35em;
background: lighten($pwdbl, 15%);
border-radius: 50%;
position: relative;
&:before {
content: '';
display: block;
position: absolute;
top: -0.22em;
left: 0;
border-left: 0.2em solid transparent;
border-right: 0.20em solid transparent;
border-bottom: 0.35em solid lighten($pwdbl, 15%);
}
&.center {
top: 0.1em;
}
&#drop-1, &#drop-4 {
clear: both;
margin-left: 50%;
transform: translateX(-50%);
}
&#drop-2 {
float: left;
clear: left;
}
&#drop-3 {
float: right;
clear: right;
}
&#drop-4 {
top: 0.17em;
}
}
}
#mountains {
width: 0;
height: 0;
border-left: 1.25em solid transparent;
border-right: 1.25em solid transparent;
border-bottom: 1.75em solid lighten($gray, 30%);
top: 1.5em;
left: 4em;
position: relative;
&:after {
content: '';
display: block;
position: absolute;
left: 0em;
width: 0;
height: 0;
bottom: -1.75em;
border-left: 0.75em solid transparent;
border-right: 0.75em solid transparent;
border-bottom: 1.15em solid lighten($gray, 45%);
}
}
#temp {
font-size: 1.5em;
display: inline-block;
vertical-align: top;
font-family: 'Montserrat', sans-serif;
margin-top: 0em;
margin-left: 4.75em;
span {
font-size: 0.65em;
display: inline-block;
padding-top: 0.25em;
vertical-align: top;
}
}
}
#month-name {
text-transform: uppercase;
font-size: 0.7em;
position: absolute;
top: 1em;
right: 3em;
}
#card {
width: 88%;
position: absolute;
bottom: 0;
left: 50%;
margin-left: -44%;
perspective: 600px;
overflow: hidden;
height: 10em;
background: transparent;
.content {
background: #FFF;
padding: 0.5em;
display: inline-block;
transform: rotateX(-90deg);
transform-origin: bottom;
position: absolute;
bottom: 0;
height: 100%;
}
#event-name {
color: $dkgray;
text-align: center;
margin-top: 0.5em;
padding-bottom: 0.75em;
}
#event-details {
position: relative;
width: 100%;
white-space: nowrap;
text-align: center;
.col-3 {
width: 33%;
display: inline-block;
color: $dkgray;
vertical-align: top;
float: left;
h3 {
font-size: 0.6em;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
}
i {
color: $lavender;
&.fa-user {
background: $lavender;
color: #FFF;
border-radius: 50%;
font-size: 0.6em;
width: 1.5em;
height: 1.5em;
line-height: 1.5em;
}
}
p {
font-size: 0.6em;
white-space: normal;
color: $gray;
}
}
}
}
#bg-card{
width: 82%;
height: 10.5em;
position: absolute;
bottom: 0;
left: 50%;
margin-left: -41%;
perspective: 600px;
overflow: hidden;
.content {
background: $gray;
padding: 0.5em;
display: inline-block;
transform: rotateX(-90deg);
transform-origin: bottom;
position: absolute;
bottom: 0;
height: 100%;
width: 100%;
}
}
}
}
.hide, .show {
transition: all 0.1s ease-in-out;
}
.show {
@include hideOrShow(none, block);
opacity: 1;
z-index: 4;
}
.hide {
@include hideOrShow(block, none);
opacity: 0;
z-index: 1;
}
.day-details {
clear: both;
transform: scaleY(0);
transition: all 0.3s ease-in-out;
margin: 0 1em 0 -1.5em;
transform-origin: top center;
input,.input {
transform: scaleY(0);
border: 0;
box-shadow: none;
padding: 0;
transition: height 0.3s ease-in-out;
width: 100%;
display: block;
height: 0;
background: #FFF;
color: $dkgray;
font-size: 0.85em;
font-family: 'Montserrat', sans-serif;
}
.expanded ~ &.expanded{
transform: scaleY(1);
transition: all 0.3s ease-in-out;
input, .input {
border: 0;
box-shadow: none;
padding: 1em 1.5em;
line-height: 13px;
transform: scaleY(1);
box-sizing: content-box;
margin: 0 0 0.5em;
height: 13px;
background: #FFF;
transition: height 0.3s ease-in-out;
}
#input-arrow {
width: 0;
height: 0;
position: relative;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #FFF;
transition: margin-left 0.25s ease-in-out;
}
}
}
var allMonths, dayArray = [], click = 0, dotw = [/Sun/gi,/Mon/gi,/Tue/gi,/Wed/gi, /Thu/gi,/Fri/gi,/Sat/gi];
function getAllDays(month, year) {
var date = new Date(year, month, 1);
var days = [];
while (date.getMonth() === month) {
var dayToPush = new Date(date);
days.push(dayToPush);
date.setDate(date.getDate() + 1);
}
return days;
}
function getYear(){
var d = new Date();
var curYear = d.getFullYear();
return curYear;
}
function addElements (query, id){
//for onload, use activeIndex+1 as query value
document.getElementById(id).innerHTML = '';
var allDays = getAllDays((query), getYear());
for(var i = 0; i<allDays.length; i++){
allDays[i] = allDays[i].toString();
}
var stopNow = false, counter = 0;
for(var i = 0; i<dotw.length; i++){
if(allDays[0].match(dotw[i])){
stopNow = true;
} else {
if (!stopNow) {
counter += 1;
}
}
}
for(var i=0; i<counter; i++){
allDays.unshift(" ");
}
for(var i=0; i<allDays.length; i++){
var singleDay = document.createElement('div');
singleDay.className = 'day';
singleDay.dataset.title = '';
singleDay.dataset.location = '';
//Parse Day
if(allDays[i]!==" "){
var dayOTW = allDays[i].split(' ')[2];
if(dayOTW.charAt(0)==="0"){
allDays[i]=dayOTW.replace(/0/gi, '');
} else {
allDays[i] = dayOTW;
}
}
singleDay.innerHTML = allDays[i]; document.getElementById(id).appendChild(singleDay);
}
var allOfDays = document.querySelectorAll('#days .day');
var dayArray = [];
for(var i = 0; i< allOfDays.length; i++){
if(i === 6 || i === 13 || i === 20 || i === 27 || i === 34){
// dayArray.push(i);
// console.log(allOfDays[i]);
allOfDays[i].outerHTML += '<div class="day-details"><div id="input-arrow"></div><div class="input"></div></div>'
}
}
document.getElementById(id).innerHTML += '<div class="day-details"><div id="input-arrow"></div><div class="input"></div><div style="clear:both"></div>';
}
//Thanks: http://stackoverflow.com/questions/4649699/is-it-possible-to-get-elements-numerical-index-in-its-parent-node-without-loopi
function whichChild(elem){
var i= 0;
while((elem=elem.previousSibling)!=null) ++i;
return i;
}
window.onload = function(){
allMonths = document.querySelectorAll('.month');
var monthCont = document.getElementById('months');
for(var i=0; i<allMonths.length; i++){
allMonths[i].innerHTML += ' ' + getYear();
}
addElements(0, 'days');
}
document.body.addEventListener('click',function(e){
var currentActive = document.querySelector('#months .month.active');
var calWidth = Number(getComputedStyle(currentActive).width.replace(/px/gi,''));
var activeIndex = 0;
for(var i=0; i<allMonths.length; i++){
if(allMonths[i].innerHTML === currentActive.innerHTML){
activeIndex = i;
}
}
if(e.target.id==='nextMt'){
if(activeIndex<11) {
document.querySelector('#months .month:first-child').style.marginLeft = -(calWidth * (activeIndex+1))+'px';
currentActive.className = 'month';
allMonths[activeIndex+1].className += ' active';
addElements((activeIndex+1), 'days');
} else {
document.querySelector('#months .month:first-child').style.marginLeft = '0px';
currentActive.className = 'month';
allMonths[0].className += ' active';
addElements(0, 'days');
}
} else if(e.target.id==='lastMt'){
if(activeIndex>0) {
document.querySelector('#months .month:first-child').style.marginLeft = -(calWidth * (activeIndex-1))+'px';
currentActive.className = 'month';
allMonths[activeIndex-1].className += ' active';
addElements((activeIndex-1), 'days');
} else {
document.querySelector('#months .month:first-child').style.marginLeft = -(calWidth * 11) + 'px';
currentActive.className = 'month';
allMonths[11].className += ' active';
addElements(11, 'days');
}
}
if(e.target.id === 'color-picker'){
document.querySelector('#dates.show').className = 'hide';
document.getElementById('colors').className = 'show';
e.target.className = 'hide';
}
if(e.target.id === 'back'){
document.getElementById('color-picker').className = document.getElementById('color-picker').className.replace(/hide/gi,'show');
document.getElementById('info').className = document.getElementById('info').className.replace(/show/gi,'hide');
document.getElementById('dates').className = document.getElementById('dates').className.replace(/hide/gi,'show');
}
if(e.target.className === 'color'){
var allColors = document.querySelectorAll('.color');
for(var i = 0; i<allColors.length; i++){
allColors[i].className = 'color';
if(allColors[i].id === e.target.id){
allColors[i].className += ' active';
}
}
document.querySelector('body > div').className = 'prev-'+document.querySelector('body > div').className+' '+document.querySelector('.color.active').id;
document.querySelector('body > div').className = document.querySelector('.color.active').id;
}
if(e.target.id === 'close'){
if(e.target.parentNode.id==='colors'){
e.preventDefault();
e.target.parentNode.className = 'hide';
document.getElementById('dates').className = 'show';
document.getElementById('color-picker').className = 'show';
}
}
if(e.target.className.match(/day/gi) && e.target.parentNode.id === 'days'){
for(var i = 0; i<document.querySelectorAll('.day-details.expanded').length; i ++){
document.querySelectorAll('.day-details.expanded')[i].className = document.querySelectorAll('.day-details.expanded')[i].className.replace(/ expanded/gi, '');
}
for(var i = 0; i<document.querySelectorAll('.day.expanded').length; i ++){
if(document.querySelectorAll('.day.expanded')[i].innerHTML !== e.target.innerHTML){
document.querySelectorAll('.day.expanded')[i].className = document.querySelectorAll('.day.expanded')[i].className.replace(/ expanded/gi, '');
}
}
if(e.target.className.match(/expanded/gi)){
e.target.className = e.target.className.replace(/ expanded/gi,'');
} else {
e.target.className += ' expanded';
}
var currElm = e.target;
while (!currElm.nextSibling.className.match(/day-details/gi)){
currElm = currElm.nextSibling;
}
currElm.nextSibling.className += ' expanded';
currElm.nextSibling.childNodes[0].style.marginLeft = (e.target.offsetLeft + 8) + 'px';
}
if(e.target.className === 'input'){
e.target.outerHTML = '<input type="text"/>';
document.querySelector('.day-details.expanded input').focus();
}
if(e.target.tagName === 'A' && e.target.parentNode.className === 'input'){
click += 1;
setTimeout(function(){
if (click > 1){
document.querySelector('.day-details.expanded .input').outerHTML = '<input type="text" value="'+document.querySelector('.day-details.expanded .input a').innerHTML+'"/>';
document.querySelector('.day-details.expanded input').focus();
document.querySelector('.day-details.expanded input').setSelectionRange(document.querySelector('.day-details.expanded input').value.length, document.querySelector('.day-details.expanded input').value.length);
} else if (click === 1){
document.getElementById('color-picker').className = document.getElementById('color-picker').className.replace(/show/gi,'hide');
document.getElementById('month-name').innerHTML = document.querySelector('.month.active').innerHTML.replace(' 2016',''); document.getElementById('info').className = 'show';
document.getElementById('actual-date').style.left = document.querySelector('.day.expanded').offsetLeft + 'px';
document.getElementById('actual-date').style.top = document.querySelector('.day.expanded').offsetTop + 'px';
document.getElementById('dates').className = 'hide';
TweenMax.to("#actual-date", ((document.querySelector('.day.expanded').offsetTop*2.5)/document.getElementById('calendar').clientHeight), {
bezier: {
values: [{
x: 0,
y: 0
}, {
x: (3*(document.getElementById('calendar').clientWidth-document.querySelector('.day.expanded').offsetLeft - 28))/4,
y: -(1*(document.querySelector('.day.expanded').offsetTop - 9))/4
}, {
x: document.getElementById('calendar').clientWidth-document.querySelector('.day.expanded').offsetLeft - 26,
y: -(document.querySelector('.day.expanded').offsetTop - 7)
}]
}
});
document.getElementById('actual-date').innerHTML = document.querySelector('.day.expanded').innerHTML;
document.getElementById('event-name').innerHTML = document.querySelector('.day-details.expanded .input a').innerHTML;
document.querySelector('.day-details.expanded').className = document.querySelector('.day-details.expanded').className.replace(/ expanded/, '');
document.querySelector('.day.expanded').className = document.querySelector('.day.expanded').className.replace(/ expanded/, '');
}
click = 0;
}, 500);
}
});
document.body.addEventListener('keyup', function(e){
if(e.keyCode === 13){
document.querySelector('.day.expanded').dataset.title = document.querySelector('.day-details.expanded input').value;
if(document.querySelector('.day-details.expanded input').value.length >0){
document.querySelector('.day.expanded').className += ' has-event';
document.querySelector('.day-details.expanded input').outerHTML = '<div class="input"><a>'+document.querySelector('.day-details.expanded input').value+'</a></div>';
} else {
if(document.querySelector('.day.expanded').className.match(/ has-event/gi)){
document.querySelector('.day.expanded').className = document.querySelector('.day.expanded').className.replace(/ has-event/gi,'');
}
document.querySelector('.day-details.expanded input').outerHTML = '<div class="input"></div>';
}
click = 0;
}
});
Also see: Tab Triggers