In a full version of the site it seems ok, but in a mobile version there are big space when the text in a short form and the space is equal to the full text size.
The preview shows without spaces, but when I open my site using iphone I see spaces
I use the code below:
let fullText1, fullText2,fullText3, fullText4, fullText5; // variable to hold the full text
let shortText1,shortText2, shortText3, shortText4, shortText5; // variable to hold the short version of the text
// За полной документацией по API, включая примеры кода, зайдите на http://wix.to/94BuAAs
$w.onReady(function() {
// how many characters to include in the shortened version
const shortTextLength = 0;
// read the full text and store it in the fullText variable
fullText1 = $w("#text19").text;
// grab the number of characters defined in shortTextLength and store them in the shortText variable
shortText1 = fullText1.substr(0, shortTextLength) + "";
// set the contents of the text element to be the short text
$w("#text19").text = shortText1;
});
$w.onReady(function() {
// how many characters to include in the shortened version
const shortTextLength = 0;
// read the full text and store it in the fullText variable
fullText2 = $w(" #text21").text;
// grab the number of characters defined in shortTextLength and store them in the shortText variable
shortText2 = fullText2.substr(0, shortTextLength) + "";
// set the contents of the text element to be the short text
$w("#text21").text = shortText2;
});
$w.onReady(function() { // how many characters to include in the shortened version const shortTextLength = 0; // read the full text and store it in the fullText variable fullText3 = $w(" #text23").text; // grab the number of characters defined in shortTextLength and store them in the shortText variable shortText3 = fullText3.substr(0, shortTextLength) + ""; // set the contents of the text element to be the short text $w("#text23").text = shortText3; }); $w.onReady(function() { // how many characters to include in the shortened version const shortTextLength = 0; // read the full text and store it in the fullText variable fullText4 = $w(" #text25").text; // grab the number of characters defined in shortTextLength and store them in the shortText variable shortText4 = fullText4.substr(0, shortTextLength) + ""; // set the contents of the text element to be the short text $w("#text25").text = shortText4; }); $w.onReady(function() { // how many characters to include in the shortened version const shortTextLength = 0; // read the full text and store it in the fullText variable fullText5 = $w(" #text27").text; // grab the number of characters defined in shortTextLength and store them in the shortText variable shortText5 = fullText5.substr(0, shortTextLength) + ""; // set the contents of the text element to be the short text $w("#text27").text = shortText5; }); //Add your code for this event here: export function button4_click(event) { // display the full text $w( "#text19").text = fullText1; // collapse the button $w("#button4").collapse(); //Add your code for this event here: } export function button5_click(event) { // display the full text $w( "#text21").text = fullText2; // collapse the button $w("#button5").collapse(); //Add your code for this event here: } export function button6_click(event) { // display the full text $w( "#text23").text = fullText3; // collapse the button $w("#button6").collapse(); //Add your code for this event here: } export function button7_click(event) { $w( "#text25").text = fullText4; // collapse the button $w("#button7").collapse(); //Add your code for this event here: } export function button8_click(event) { //Add your code for this event here: $w( "#text27").text = fullText5; // collapse the button $w("#button8").collapse(); }
Instead of this line:
fullText1 = $w("#text19").text;
use:
fullText1 = "this is my full text blah blah blah blah" // use your real full text. for line break use \n
In the text box itself ("text19") leave 1 letter only, and place the next element right below this text element.