Sha256: b688d29b8c884bea3f1512e3dfcb5b7d9548ec90ab8769e4c5d4237df9bd9a99
Contents?: true
Size: 867 Bytes
Versions: 2
Compression:
Stored size: 867 Bytes
Contents
/** * FORM ITEM EDITOR */ class FormItemEditor { constructor() { this.target = ".form-item--editor"; } isSet() { if ($(this.target).length > 0) { return true; } else { return false; } } setEvents() { // run resize to set initial size this.resize(); // run resize on each of these events $(window).resize(() => { this.resize(); }); } resize() { $(this.target).each(function() { // If the form item editor is closed don't go any further if ($(this).height() === 0) return; // otherwise update the max-height which is needed for the CSS transition // NOTE you need to remove the max-height (inside 'style' attribute) to get the real height $(this).get(0).style.height = "auto"; $(this).get(0).style.maxHeight = $(this).get(0).scrollHeight + "px"; }); } } export let _FormItemEditor = new FormItemEditor();
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
binda-0.1.5 | app/assets/javascripts/binda/components/form_item_editor.js |
binda-0.1.4 | app/assets/javascripts/binda/components/form_item_editor.js |