1. I'm faced with the challenge of developing an event calendar that is compatible with all web browsers. For instance:
2. If I schedule an event from 9:30 to 10:30 am, it should occupy 100% width on the calendar.
3. Then, when I add another event from 9:45 to 11:00 am, I want the first event (from point 2) to shrink to 50% width and be shifted right by 50% to accommodate the new event.
4. Subsequently, if I add a third event from 10:00 am to 12:00 pm, each event should now have a width of 33%, arranged without overlapping one after the other.
- I've been attempting to achieve this using JavaScript.
- I successfully managed to add two events without any overlap.
- However, introducing a third event results in overlap.
- I thought about storing each element's configuration in an array and checking previous elements' configurations to properly place the next event.
Is there a more efficient way to implement this event scheduling feature in a calendar using JavaScript? Any suggestions would be greatly appreciated!
Thank you!