jackducasse / caleandar

A lightweight, library independent JavaScript calendar
MIT License
80 stars 41 forks source link

Events on same day are overlapping #13

Open ErikLindner opened 2 years ago

ErikLindner commented 2 years ago

The HTML elements are overlapping if I set two events on the same day. grafik

grafik

Did someone have this issue before?

PSanilP commented 9 months ago

try theme3 instead of theme1 which you are using Else modify the code like so

`var eventsOnDay = []; // Check Date against Event Dates for (var n = 0; n < calendar.Model.length; n++) { var evDate = new Date(calendar.Model[n].Date); var toDate = new Date(calendar.Selected.Year, calendar.Selected.Month, (i + 1)); if (evDate.getDate() == toDate.getDate() && evDate.getMonth() == toDate.getMonth() && evDate.getFullYear() == toDate.getFullYear()) { var title = document.createElement('div'); if (typeof calendar.Model[n].Link == 'function' || calendar.Options.EventClick) { var a = document.createElement('a'); a.setAttribute('href', '#'); a.innerHTML += calendar.Model[n].Title; if (calendar.Options.EventClick) { var z = calendar.Model[n].Link; if (typeof calendar.Model[n].Link != 'string') { a.addEventListener('click', calendar.Options.EventClick.bind.apply(calendar.Options.EventClick, [null].concat(z))); if (calendar.Options.EventTargetWholeDay) { day.className += " clickable"; day.addEventListener('click', calendar.Options.EventClick.bind.apply(calendar.Options.EventClick, [null].concat(z))); } } else { a.addEventListener('click', calendar.Options.EventClick.bind(null, z)); if (calendar.Options.EventTargetWholeDay) { day.className += " clickable"; day.addEventListener('click', calendar.Options.EventClick.bind(null, z)); } } } else { a.addEventListener('click', calendar.Model[n].Link); if (calendar.Options.EventTargetWholeDay) { day.className += " clickable"; day.addEventListener('click', calendar.Model[n].Link); } } title.appendChild(a); } else { title.innerHTML += '' + calendar.Model[n].Title + ''; } eventsOnDay.push(title); } } if (eventsOnDay.length > 0) { number.className += " eventday"; var titleW = document.createElement('div'); titleW.className += "cld-title"; for (var n = 0; n < eventsOnDay.length; n++) { titleW.appendChild(eventsOnDay[n]); } number.appendChild(titleW); }

`

Clipboard01