altinn-designsystem
Version:
Altinn Design system based on Pattern Lab.
23 lines (21 loc) • 663 B
JavaScript
var setupExpandContent = function() {
var expandContent = function() {
$($(this).data('target')).addClass('a-expanded');
$(this).hide();
};
$('*[data-toggle="altinn-expand"]').each(function() {
var targetHeight;
var $target = $($(this).data('target'));
$target.removeClass('a-expandable-content');
targetHeight = $target.outerHeight();
$(this).off('click', expandContent);
if (targetHeight > 320) {
$target.addClass('a-expandable-content');
$target.removeClass('a-expanded');
$(this).on('click', expandContent);
$(this).show();
} else {
$(this).hide();
}
});
};