Inspire from jackducasse/caleandar and I fork to [My Reposite] (https://github.com/rachmanzz/calendar) that make A lightweight, library independent JavaScript calendar.
Default theme using jackducasse/caleandar theme, but you can make custom theme by your own. You don't need follow default theme structure, you can make by your own structure but you need extra time to write your own thema in Element Calendar.
To call instance Element Calendar like this:
var element = document.getElementById('calendar')
var calendar = new ElementCalendar(new Date()
// or
var calendar = new ElementCalendar(new Date(2019, 10, 1)
calendar.create(element) // to create calandar
Extra setting is possible at Element Calendar
var calendar = new ElementCalendar(new Date(), { /** setting **/ } )
-
Add Extra Style using
styles
object- date
- currentMonth
- prevMonth
- nextMonth
- today
- selectedDay
-
Add custom tag and style using
templetes
object- date
- currentMonth
- prevMonth
- nextMonth
-
add event click by
onclick
object- date
In this case you can inject your own html template, no worry about default html structure.
var element = document.getElementById('calendar')
var calendar = new ElementCalendar(new Date()
var custom = [
{
node: 'div', className: ['class'],
attr: [ { name: 'title', value: 'Menu' } ],
onlick: function () { /* click event */ },
child: [ { node: 'div', className: ['class'] } ]
}
]
calendar.custom(custom).create(element) // to create calandar
- node is html item tag like div, a, img and etc
- className is class array
- attr is html tag attribute
- onclick is event click in your html tag
- child to inject child html tag to your current html tag
theme from https://codepen.io/eliza-rjb/pen/xmbEWX