Hi,
I used the code below to show short text that can expand on click.
When I did it, I lost the original text formatting (the font size is not the same).
What do you think I should do to resolve this issue?
Thanks,
This is the code I used:
let fullText;
let shortText;
$w.onReady(function () {
const shortTextLength = 400;
fullText = $w("#text1").text;
shortText = fullText.substr(0, shortTextLength) + "...";
$w("#text1").text = shortText;
});
export function button1_click_1(event) {
if ($w("#text1").text === shortText) {
$w("#text1").text = fullText;
$w("#button1").label = "Show less";
} else {
$w("#text1").text = shortText;
$w("#button1").label = "Read more...";
}}
See the Wix Code Tutorial: Creating a Show-More Link. Good luck