From 88ac407cf37e365a5f19bc68cac7c802a15cf77c Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 9 Aug 2023 14:53:50 +0200 Subject: [PATCH] Cart: Disable sneak peek on very small carts (#3512) --- src/pretix/static/pretixbase/js/details.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pretix/static/pretixbase/js/details.js b/src/pretix/static/pretixbase/js/details.js index 52603eb65c..fd2feaa185 100644 --- a/src/pretix/static/pretixbase/js/details.js +++ b/src/pretix/static/pretixbase/js/details.js @@ -4,9 +4,18 @@ setup_collapsible_details = function (el) { el.find('details.sneak-peek:not([open])').each(function() { this.open = true; - var $elements = $("> :not(summary)", this).show().filter(':not(.sneak-peek-trigger)').attr('aria-hidden', 'true'); - + var $elements = $("> :not(summary)", this).show().filter(':not(.sneak-peek-trigger)'); var container = this; + + if ($("> :not(summary)", this).show().filter(':not(.sneak-peek-trigger)').height() < 200) { + $(".sneak-peek-trigger", this).remove(); + $(container).removeClass('sneak-peek'); + container.style.removeProperty('height'); + return; + } + + $elements.attr('aria-hidden', 'true'); + var trigger = $('summary, .sneak-peek-trigger button', container); function onclick(e) { e.preventDefault();