Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

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.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              </head>

<body>
  <div id="loading">

    <div class="todo-container">
      <button class="hamburger">&#9776;</button>
      <button class="cross">&#735;</button>
    </div>
    <div class="todo-bar">
      <input type="text" id="task" placeholder="type todo & hit enter">
      <div class="todo-list" id="todos"></div>
    </div>
    <div class="weather">
      <span class="display-weather text-right"></span>
      <span class="weather-icon"></span>
      <div class="display-location"></div>
    </div>

    <div id="monthDiv">
      </select>

    </div>

    <div id="monthOutput">
      <!-- <h1 id="monthName"></h1> -->
      <h1 id="time"></h1>
      <ul id="days">

      </ul>

    </div>
    <footer>
      <div>
        <p class="quote-text"></p>
        <p class="author-text"></p>
      </div>
    </footer>
  </div>

            
          
!

CSS

            
              *{
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}
html{
    color: #FDF4F4;
    font-family: "Lato", "Arial", "sans-serif";
    font-size:20px;
    font-weight: 300;
    text-rendering: optimizeLegibility;
    overflow: hidden;
    background-size: cover;
    background-repeat: no-repeat;
   
}


/* Weather */

.weather{
        position: relative;
        float: right;
}

.weather-icon{
    color: #e67e22;
    display: inline-block;
    width:30px;
    text-align: center;
    font-size: 120%;
    vertical-align: middle;
    margin-top: -5px;
    margin-right: 10px;
    line-height:120%;
} 



.display-weather{
    margin-top: 10px;
    display: inline-block;
    font-family: 'Roboto',arial,sans-serif;
    font-size: 120%;
}

.display-location{
    font-family: 'Roboto',arial,sans-serif;
    font-size: 120%;
    margin-top: 5px;

}



footer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1rem;
    /* background-color: #efefef; */
    text-align: center;
    font-size:75%;
    color: white;
    font-weight: 300;
  }

/* Declan styles for calendar */



#monthName {
    text-align: center;
    text-decoration: underline;
    display: inline-block;

}

#time {
    position: relative;
    text-align: center;
}

div#monthOutput li{
    /* background-color: rgba(243, 242, 242); */
    background-color: rgba(71, 69, 69, 0);
    height: 100px;
    width: 150px;
    margin: .5px;
    text-decoration: none;
    display: inline-block;
    border-style: ridge;
    border-width:.5px;
    cursor: pointer;
}

#monthOutput {
    padding: 70px;
    
}

h1 {
    color: #ECECEC;
    position: absolute;
}

#days{
    color:white;
    margin-top: 2em;
}


/* todos */

.todo-container{

    position: absolute; 
    left:.31em;
    top:.5em;
    width: 3em;
    padding: 1.5em;
    border-radius: 100%;
    transition: all .2s ease-out;
    
}

#todos{
    color:black;
    display: block;
    /* background: rgba(0,0,0,.2); */
}

/* rgba(0,0,0,.5); */

#task{
  /* background:  rgba(255, 255, 255, 0.96); */
  background: rgba(0,0,0,.5);
  border: none;
  font-size: 80%;
  color: #fff;
  border-radius: 6px;
  width: 230px;
  margin-left: 20px;
  margin-top: 10px;
  padding-left: 5px;
  margin-bottom: 10px;
  
}
  
  /* box-shadow: 
  inset 0 0 8px  rgba(94, 93, 93, 0.06),
        0 0 16px rgba(100, 99, 99, 0.1); */

input[type=text]{
    color:black;
    padding-left:10px;
}

.todo-bar{
    /* margin-top:10px; */
    margin-left: 17px;;
    background: rgba(0, 0, 0, 0.5);
    width: 275px;
    position: absolute;
    top: 5em; left: 1em; 
    max-height: 100%;
    border-radius: 4px;
    

}

.todo-bar : hover{
    
}


div.todo-list ul{
    margin: 0;
    padding: 0;
    width: auto;
    list-style: none;
}

div.todo-list li{
    cursor: pointer;
    position: relative;
    padding: 2px 20px 12px 20px;
    width:275px;
    font-size: 80%;
    transition: all 0.2s ease-out;
    color:white;
    letter-spacing: .5px;
    list-style: none;
}

 .hamburger,
.cross{
    font-size: 120%;
    cursor: pointer;
    position: absolute;
    background:transparent;
    color:white;
    border:0;
    opacity: 0%;
    padding: 5px 15px 5px 15px;
    font-size: bold;
    transition: all 2s ease out;
    
}
button:focus {outline:0;}



.hamburger,
.cross :hover{
    font-size: 120%;
    cursor: pointer;
    position: absolute;
    background:transparent;
    color:white;
    border:none;
    opacity: 100%;
    

}

/* remove button */

.remove{
    position: absolute;
    right:10px;
    margin-left:10px;
    margin-right: 15px;
    width:15px;
    height:15px;
    padding-top:.2px;
    cursor: pointer;
}

.taskCompleted{
    text-decoration: line-through;
    color:black;
}



            
          
!

JS

            
              
//todo list
//retrieve todo's from localStorage.Retun an empty array if no list is found
//localStorage are key/valye pairs and always stored as strings. Always parse them
//to a valid JS object before using them

var elDays = document.getElementById('days');
var elList = document.querySelector('ul');
var elH1 = document.querySelector('h1');
var select = document.querySelector('select');


var d = new Date();
// var today = date.getDate() + "_" + (date.getMonth()+1) + "_" + date.getFullYear();

//changes background from day to night from 6:00pm to 6 a.m.
function updateBackground(){
    var hour = d.getHours();

    if(hour > 6 && hour < 18) 
        document.body.style.backgroundImage = "url('images/day.jpg')";      
    else
        document.body.style.backgroundImage = "url('images/darkSky.jpg')";
}
updateBackground();

//takes month for creating calendar
var monthArray = new Array(12);
monthArray[0] = "January";
monthArray[1] = "Febuary";
monthArray[2] = "March";
monthArray[3] = "April";
monthArray[4] = "May";
monthArray[5] = "June";
monthArray[6] = "July";
monthArray[7] = "August";
monthArray[8] = "September";
monthArray[9] = "October";
monthArray[10] = "November";
monthArray[11] = "December";

var utcMonth = monthArray[d.getUTCMonth()];


//updates the date every second
function updateClock(){
    var date = new Date();
    var n = date.toDateString();
    var time = date.toLocaleTimeString();
    var elTime = document.getElementById('time');
    timeContent = elTime.innerHTML;
    elTime.innerHTML = n + ' ' + time;
}

 setInterval(updateClock, 1000); 


 //creates a calendar depending upon which month it is
function createCalendar(days, choice){
    elList.innerHTML = '';
    elH1.textContent = utcMonth;
    var days = 31;
    if(choice === 'February'){
        days = 28;
    } else if(choice === 'April' || choice === 'June' || choice === 'September' || choice === 'November'){
        days = 30;
    } 
    for(var i = 1; i <= days; i++) {
    var elListItem = document.createElement('li');
    elListItem.textContent = i;
    elList.appendChild(elListItem);
    }
}

createCalendar();

var date = new Date(); // current date
var dateClicked = date.getDate() + "_" + (date.getMonth()+1) + "_" + date.getFullYear();

var month = (date.getMonth())+1; //current month
var year = date.getFullYear(); //current year

//get todo's from localStorage
function get_todos(){
    var todos = [];
    var todos_str = localStorage.getItem(dateClicked); 
    if(todos_str !=null){
        todos = JSON.parse(todos_str);
    }
    return todos;
}
// Adding a new TODO entry
function add(){
    var todos = get_todos();
    var task = $('#task').val();     
    var taskObj = {    
        task:task,
        isDone:false,
    };
    
    todos.push(taskObj);
    
    localStorage.setItem(dateClicked,JSON.stringify(todos));
    //update list of the TODO's displayed on webpage
    show();
    $("input").val("");
    //avoid any further actions generated by 'click' event
    return false;
}

//remove the to-do list items from localStorage
function removeStorage(){
    var todos = get_todos();    
    var id = event.currentTarget.getAttribute('id');
        todos.splice(id,1);
    localStorage.setItem(dateClicked,JSON.stringify(todos));
    show();
    return false;
}

//update localStorage for completed tasks
function updateLocalStorage(val){
    
     var todos = get_todos();
        for(var i=0;i<todos.length;i++){
            if(todos[i].task === val){
                    todos[i].isDone = true;
            }
        }
    localStorage.setItem(dateClicked,JSON.stringify(todos));
    
}

//display the current todo list on webpage
function show(){

    var todos = get_todos();
    var html="<ul>";
    for(var i=0; i<todos.length; i++) {
        var addClassStr = todos[i].isDone ? 'class=taskCompleted' : '';
        html+= '<li ' + addClassStr + ' value='+ todos[i].task + '>' + todos[i].task + '<button class="remove" id="' + i  + '">x</button></li>';
    }
    html+="</ul>";
    $("#todos").html(html);
    $(".remove").click(function(event){
        event.currentTarget.parentElement.remove();
        removeStorage();        
    }); 
    
    $("#todos").on('click','li',function(){
        $(this).addClass("taskCompleted");
        updateLocalStorage($(this).attr("value"));

    });
}

$("input").keydown(function(e){
    if( $(this).val()!=="" && e.keyCode===13){
        event.preventDefault();
        add();    
    }
});


$(".todo-bar").hide();
$(".cross").hide();
    $(".hamburger").click(()=>{
    $(".todo-bar").slideToggle( "slow", ()=> {
        $( ".hamburger" ).hide();
        $( ".cross" ).show();
        });
    });
   $(".cross").click(()=>{
       $(".todo-bar").slideToggle("slow",()=>{
           $(".cross").hide();
           $(".hamburger").show();
        });
   });

$("#days").click(function(event){
    // $(".todo-bar").slideToggle( "slow", function() {
    //     $( ".hamburger" ).hide();
    //     $( ".cross" ).show();
    //     });
    $(".todo-bar").show("slow",function(){
        $(".hamburger").hide();
        $(".cross").show();
    });

    dateClicked = $(event.target).text()+ "_" + month + "_" + year; 
    show();    
    //console.log(id);       
});

$(document).ready(function(){
    document.getElementById("todo-bar").onload = function(){
        show();
    };   
        
});
show(); 








  
   

            
          
!
999px

Console