Hello everyone, I used this code to reduce the text in my website and have read more bottom to expand the text if necessary. (there are more than one text)
let Text3; // variable to hold the full text
let Text3short; // variable to hold the short version of the text
$w.onReady( function () {
//TODO: // how many characters to include in the shortened version
const Text3shortLength = 342;
// read the full text and store it in the Text3 variable
Text3 = $w(“#text3”).text;
// // grab the number of characters defined in Text3shortLength and store them in the Text3short variable
Text3short = Text3.substr(0, Text3shortLength) + “…”;
// set the contents of the text element to be the short text
$w(“#text3”).text = Text3short;
});
export function button6_click(event, $w) {
if ($w(“#text3”).text === Text3short) {
// if currently displaying short text, display the full text
$w(“#text3”).text = Text3;
$w(“#button6”).label = “Read less”;
} else {
// if currently displaying full text, display the short text
$w(“#text3”).text = Text3short;
$w(“#button6”).label = “Read more”;
}
}
The problem now is that the column strip where the text is maintain the same size all the time. so I would like it to expand or shorten depend of the text inside it.