CLNDR.js test
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.1.0/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="http://kylestetz.github.io/CLNDR/js/clndr.js"></script>
<div id="full-clndr"></div>
CSS
#full-clndr {
background-color: #ebebeb;
font-weight: 700;
-moz-box-shadow: 4px 4px 0 #343434;
-webkit-box-shadow: 4px 4px 0 #343434;
box-shadow: 4px 4px 0 #343434;
}
#full-clndr .clndr-grid {
float: left;
width: 65%;
border-right: 2px solid white;
}
#full-clndr .clndr-grid .days-of-the-week {
width: 100%;
background-color: #3883a3;
}
#full-clndr .clndr-grid .days-of-the-week .header-day {
float: left;
width: 14.2857%;
padding: 14px;
text-align: center;
color: white;
}
#full-clndr .clndr-grid .days {
width: 100%;
}
#full-clndr .clndr-grid .days .day,
#full-clndr .clndr-grid .days .empty {
float: left;
width: 14.2857%;
height: 66px;
padding: 24px 0;
text-align: center;
color: #4f4f4f;
background-color: #ebebeb;
border-bottom: 2px solid white;
background-image: url('./triangle.svg');
background-size: cover;
background-position: center;
}
#full-clndr .clndr-grid .days .day.event .day-number,
#full-clndr .clndr-grid .days .empty.event .day-number {
padding-bottom: 4px;
border-bottom: 2px solid #3883a3;
}
#full-clndr .clndr-grid .days .today {
background-color: white;
background-image: none;
}
* {
margin: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
font-family: Inconsolata, Monaco, 'Andale Mono', Courier;
font-size: 18px;
color: #212121;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
strong {
font-weight: 700;
}
@media all and (max-width: 768px) {
#full-clndr .clndr-grid {
width: 100%;
border: none;
}
}
JavaScript
/**
* ~ CLNDR v1.4.1 ~
* ==============================================
* https://github.com/kylestetz/CLNDR
* ==============================================
* Created by kyle stetz (github.com/kylestetz)
* & available under the MIT license
* http://opensource.org/licenses/mit-license.php
* ==============================================
*
* This is the fully-commented development version of CLNDR.
* For the production version, check out clndr.min.js
* at https://github.com/kylestetz/CLNDR
*
* This work is based on the
* jQuery lightweight plugin boilerplate
* Original author: @ajpiano
* Further changes, comments: @addyosmani
* Licensed under the MIT license
$('#clndr-defaults').clndr({
template: $('#calendar-template').html(),
events: [
{ date: '2018-11-07', title: 'CLNDR GitHub Page Finished', url: 'http://github.com/kylestetz/CLNDR' }
],
clickEvents: {
click: function(target) {
console.log(target);
},
onMonthChange: function(month) {
console.log('you just went to ' + month.format('MMMM, YYYY'));
}
},
doneRendering: function() {
console.log('this would be a fine place to attach custom event handlers.');
}
});
(function (factory) {
// Multiple loading methods are supported depending on
// what is available globally. While moment is loaded
// here, the instance can be passed in at config time.
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'moment'], factory);
}
else if (typeof exports === 'object') {
// Node/CommonJS
factory(require('jquery'), require('moment'));
}
else {
// Browser globals
factory(jQuery, moment);
}
}(function ($, moment) {
// Namespace
var pluginName = 'clndr';
// This is the default calendar template. This can be overridden.
var clndrTemplate =
"<div class='clndr-controls'>" +
...