-
Notifications
You must be signed in to change notification settings - Fork 36
/
eventcalender.html
159 lines (143 loc) · 5.14 KB
/
eventcalender.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event Calendar</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Montserrat);
.clearfix:before,
.clearfix:after {
display: table;
line-height: 0;
content: ""
}
.clearfix:after {
clear: both
}
body {
background: rgb(0, 127, 114);
}
.calender {
margin: 40px auto;
width: 70%;
padding: 20px;
background: #f7f7f7;
border: 1px solid #ccc;
color: rgb(0, 127, 114);
position: relative;
}
.calender:before,
.calender:after {
content: '';
position: absolute;
z-index: -1;
left: 0;
top: 0;
display: block;
width: 100%;
height: 100%;
background: inherit;
box-shadow: inherit;
-webkit-transform: rotate(2deg);
box-shadow: 0 0 20px rgba(0, 0, 0, .4);
}
.calender::after {
-webkit-transform: rotate(-1deg)
}
.calender h1 {
font-family: 'Montserrat';
width: 100%;
text-align: center;
text-shadow: 1px 1px 0px rgba(0, 0, 0, .6);
}
.calender .day {
display: block;
width: 13.5%;
height: 0;
padding-top: 6%;
padding-bottom: 8%;
float: left;
text-align: center;
background: #ddd;
border: 1px solid #f7f7f7;
font-family: sans-serif;
font-size: 1.4em;
-webkit-transition: all .2s ease;
cursor: pointer;
position: relative;
/* For positioning the event */
}
.calender .day:hover {
background: rgb(0, 127, 114);
color: #f7f7f7;
box-shadow: inset 0 0 20px rgba(0, 0, 0, .4);
text-shadow: 1px 1px 2px rgba(0, 0, 0, .4);
}
.calender .day.current {
background: rgba(236, 154, 24, 1);
color: #f7f7f7;
box-shadow: inset 0 0 20px rgba(0, 0, 0, .4);
text-shadow: 1px 1px 2px rgba(0, 0, 0, .4);
}
.event {
margin-top: 5px;
padding: 5px;
background: #4caf50;
color: white;
border-radius: 3px;
font-size: 0.8em;
}
</style>
</head>
<body>
<div class="calender">
<div class="month">
<h1>October - 2024</h1>
<span class="day" onclick="addEvent(this)">1</span>
<span class="day" onclick="addEvent(this)">2</span>
<span class="day" onclick="addEvent(this)">3</span>
<span class="day" onclick="addEvent(this)">4</span>
<span class="day" onclick="addEvent(this)">5</span>
<span class="day" onclick="addEvent(this)">6</span>
<span class="day" onclick="addEvent(this)">7</span>
<span class="day" onclick="addEvent(this)">8</span>
<span class="day" onclick="addEvent(this)">9</span>
<span class="day" onclick="addEvent(this)">10</span>
<span class="day" onclick="addEvent(this)">11</span>
<span class="day" onclick="addEvent(this)">12</span>
<span class="day" onclick="addEvent(this)">13</span>
<span class="day" onclick="addEvent(this)">14</span>
<span class="day" onclick="addEvent(this)">15</span>
<span class="day" onclick="addEvent(this)">16</span>
<span class="day" onclick="addEvent(this)">17</span>
<span class="day" onclick="addEvent(this)">18</span>
<span class="day" onclick="addEvent(this)">19</span>
<span class="day" onclick="addEvent(this)">20</span>
<span class="day" onclick="addEvent(this)">21</span>
<span class="day" onclick="addEvent(this)">22</span>
<span class="day" onclick="addEvent(this)">23</span>
<span class="day" onclick="addEvent(this)">24</span>
<span class="day" onclick="addEvent(this)">25</span>
<span class="day" onclick="addEvent(this)">26</span>
<span class="day" onclick="addEvent(this)">27</span>
<span class="day" onclick="addEvent(this)">28</span>
<span class="day" onclick="addEvent(this)">29</span>
<span class="day" onclick="addEvent(this)">30</span>
<span class="day" onclick="addEvent(this)">31</span>
<div class="clearfix"></div>
</div>
</div>
<script>
function addEvent(dayElement) {
const eventName = prompt("Enter event name:");
if (eventName) {
const eventDiv = document.createElement("div");
eventDiv.className = "event";
eventDiv.textContent = eventName;
dayElement.appendChild(eventDiv);
}
}
</script>
</body>
</html>