mirror of
https://github.com/pretix/pretix.git
synced 2026-04-25 23:42:32 +00:00
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 () {
|
||||
"use strict";
|
||||
|
||||
@@ -528,12 +538,11 @@ $(function () {
|
||||
}
|
||||
});
|
||||
|
||||
// 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);
|
||||
});
|
||||
// For a very weird reason, window width is 0 on an initial load of the widget
|
||||
if ($(window).width() > 0) {
|
||||
setup_week_calendar()
|
||||
} else {
|
||||
$(window).on('resize', setup_week_calendar)
|
||||
}
|
||||
|
||||
// Day calendar
|
||||
|
||||
Reference in New Issue
Block a user