From 96f479f06a94a107b389bf2f04c547bcf8e173af Mon Sep 17 00:00:00 2001 From: alexanderroese Date: Tue, 13 Aug 2024 11:31:42 +0200 Subject: [PATCH] auto change font size to small if text is too long --- snippets/shx-3d-render-input.liquid | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/snippets/shx-3d-render-input.liquid b/snippets/shx-3d-render-input.liquid index c95a64f..c996013 100644 --- a/snippets/shx-3d-render-input.liquid +++ b/snippets/shx-3d-render-input.liquid @@ -1014,6 +1014,12 @@ document.querySelector('#shx-fontSize').value = 'Klein #small'; document.querySelector('#shx-fontSize').dispatchEvent(new Event('change')); + + document.querySelector('#shx-info-text').style.display = 'block'; + + setTimeout(() => { + document.querySelector('#shx-info-text').style.display = 'none'; + }, 5000); } } @@ -1134,17 +1140,16 @@ this.Viewer3DContainer.appendChild(this.invisibleProductID); - + // create text below the iframe for information if the text is too long and we set the font size to small + + this.infoText = document.createElement('span'); + this.infoText.id = 'shx-info-text'; + this.infoText.style.display = 'none'; + this.infoText.innerText = 'Text ist zu lang. Wir haben die Schriftgröße auf klein gesetzt. Bitte überprüfe deinen Text.'; + this.container.appendChild(this.infoText); } setTimeout(createIFrame.bind(this), 1000); - - // create text below the iframe for information if the text is too long and we set the font size to small - - this.infoText = document.createElement('span'); - this.infoText.innerText = 'Here1 Text ist zu lang. Wir haben die Schriftgröße auf klein gesetzt. Bitte überprüfe deinen Text.'; - /* this.infoText.classList.add('shx-info-text'); */ - this.container.appendChild(this.infoText); } initCurrentVariant(id) {