mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Cart: Add sneak-peek preview (#3259)
This commit is contained in:
committed by
GitHub
parent
6b983d5f55
commit
38e826724f
@@ -288,6 +288,30 @@ $(function () {
|
||||
|
||||
$("#ajaxerr").on("click", ".ajaxerr-close", ajaxErrDialog.hide);
|
||||
|
||||
$('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 container = this;
|
||||
var trigger = $('summary, .sneak-peek-trigger button', container);
|
||||
function onclick(e) {
|
||||
e.preventDefault();
|
||||
|
||||
container.addEventListener('transitionend', function() {
|
||||
$(container).removeClass('sneak-peek');
|
||||
container.style.removeProperty('height');
|
||||
}, {once: true});
|
||||
container.style.height = container.scrollHeight + 'px';
|
||||
$('.sneak-peek-trigger', container).fadeOut(function() {
|
||||
$(this).remove();
|
||||
});
|
||||
$elements.removeAttr('aria-hidden');
|
||||
|
||||
trigger.off('click', onclick);
|
||||
}
|
||||
trigger.on('click', onclick);
|
||||
});
|
||||
|
||||
// Copy answers
|
||||
$(".js-copy-answers").click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -398,6 +398,27 @@ details.details-open .panel-heading .collapse-indicator,
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
details.sneak-peek {
|
||||
position: relative;
|
||||
height: 11em;
|
||||
overflow: hidden;
|
||||
transition: height .5s;
|
||||
}
|
||||
.sneak-peek-trigger {
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
width: 100%;
|
||||
height: 4.5em;
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
background: linear-gradient(0deg, rgba(248,248,248,.9) 44%, rgba(248,248,248,0) 100%);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
form.download-btn-form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user