JS: add events 'cell:open' & 'cell:close' (#53780)
This commit is contained in:
parent
428033da0f
commit
5d33dbbe23
|
@ -347,12 +347,23 @@ $(function() {
|
|||
});
|
||||
|
||||
$('div.cell').each(function(i, x) {
|
||||
compute_max_height($(this));
|
||||
if (window.location.hash == '#' + $(this).attr('id')) {
|
||||
$(this).addClass('toggled');
|
||||
const $cell = $(this);
|
||||
compute_max_height($cell);
|
||||
if (window.location.hash == '#' + $cell.attr('id')) {
|
||||
$cell.addClass('toggled');
|
||||
} else {
|
||||
$(this).addClass('untoggled');
|
||||
$cell.addClass('untoggled');
|
||||
}
|
||||
|
||||
const $animated = $cell.find('h3 + div');
|
||||
$animated.on('transitionend', function(el){
|
||||
if ($cell.is(".toggled")) {
|
||||
$cell.trigger("cell:open");
|
||||
}
|
||||
if ($cell.is(".untoggled")) {
|
||||
$cell.trigger("cell:close");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function show_asset($elem) {
|
||||
|
|
Loading…
Reference in New Issue