回答編集履歴
1
修正
answer
CHANGED
@@ -7,20 +7,18 @@
|
|
7
7
|
<title>タイトル</title>
|
8
8
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.css">
|
9
9
|
<style type="text/css">
|
10
|
-
* {
|
11
|
-
margin: 0;
|
12
|
-
|
10
|
+
.clicked {
|
11
|
+
background-color: #a9ff3a !important;
|
13
12
|
}
|
14
13
|
</style>
|
15
14
|
</head>
|
16
15
|
<body>
|
17
|
-
<div id=
|
16
|
+
<div id="calendar"></div>
|
18
17
|
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
19
18
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
|
20
19
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>
|
21
20
|
<script>
|
22
|
-
$(
|
21
|
+
$("#calendar").fullCalendar({
|
23
|
-
({
|
24
22
|
dayClick: function (date) {
|
25
23
|
if ($(this).hasClass("clicked")) { // クリックされた要素がclickedクラスだったら
|
26
24
|
$(this).removeClass("clicked");
|
@@ -31,23 +29,23 @@
|
|
31
29
|
},
|
32
30
|
viewRender: function (currentView) {
|
33
31
|
var minDate = moment(),
|
34
|
-
maxDate = moment().add(12,
|
32
|
+
maxDate = moment().add(12, "months");
|
35
33
|
// Past
|
36
34
|
if (minDate >= currentView.start && minDate <= currentView.end) {
|
37
|
-
$(".fc-prev-button").prop(
|
35
|
+
$(".fc-prev-button").prop("disabled", true);
|
38
|
-
$(".fc-prev-button").addClass(
|
36
|
+
$(".fc-prev-button").addClass("fc-state-disabled");
|
39
37
|
}
|
40
38
|
else {
|
41
|
-
$(".fc-prev-button").removeClass(
|
39
|
+
$(".fc-prev-button").removeClass("fc-state-disabled");
|
42
|
-
$(".fc-prev-button").prop(
|
40
|
+
$(".fc-prev-button").prop("disabled", false);
|
43
41
|
}
|
44
42
|
// Future
|
45
43
|
if (maxDate >= currentView.start && maxDate <= currentView.end) {
|
46
|
-
$(".fc-next-button").prop(
|
44
|
+
$(".fc-next-button").prop("disabled", true);
|
47
|
-
$(".fc-next-button").addClass(
|
45
|
+
$(".fc-next-button").addClass("fc-state-disabled");
|
48
46
|
} else {
|
49
|
-
$(".fc-next-button").removeClass(
|
47
|
+
$(".fc-next-button").removeClass("fc-state-disabled");
|
50
|
-
$(".fc-next-button").prop(
|
48
|
+
$(".fc-next-button").prop("disabled", false);
|
51
49
|
}
|
52
50
|
}
|
53
51
|
});
|