forked from CGM_Public/pretix_original
Week calendar: Fix interference between mobile mode and widget
This commit is contained in:
@@ -232,6 +232,16 @@ function setup_basics(el) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setup_week_calendar() {
|
||||||
|
// Week calendar
|
||||||
|
// On mobile, auto-collapse all days except today, if we have more than 15 events in total
|
||||||
|
if ($(window).width() < 992 && $(".week-calendar .event").length > 15) {
|
||||||
|
$(".week-calendar .weekday:not(.today)").each(function () {
|
||||||
|
$(this).prop("open", false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@@ -528,12 +538,11 @@ $(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Week calendar
|
// For a very weird reason, window width is 0 on an initial load of the widget
|
||||||
// On mobile, auto-collapse all days except today, if we have more than 15 events in total
|
if ($(window).width() > 0) {
|
||||||
if ($(window).width() < 992 && $(".week-calendar .event").length > 15) {
|
setup_week_calendar()
|
||||||
$(".week-calendar .weekday:not(.today)").each(function () {
|
} else {
|
||||||
$(this).prop("open", false);
|
$(window).on('resize', setup_week_calendar)
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Day calendar
|
// Day calendar
|
||||||
|
|||||||
Reference in New Issue
Block a user