I cannot seem to be able to get my read more button to show the rest of the text and not be so far away from the box. Can anybody help? Been on the phone to Wix for 1h and they told me to come here.
A
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Hey JD sorry for being so confusing as you can tell i am clueless, just doing this website for my mum. It was all going so well till i got to this.. haha.
Basically when I put the text in the "" it just shows the full text when its supposed to be the short text. I really appreciate all your help but i am going to have to give up, I really do not know what i have done wrong this time. Cheers :)
It just shows the text that i put in between the "" .It does not make the button work and show the rest of the text
I did so, and it doesn't work unfortunately
let fullText; // variable to hold the full text let shortText; // variable to hold the short version of the text $w.onReady(function () { // how many characters to include in the shortened version const shortTextLength = 471; // read the full text and store it in the fullText variable fullText = $w("#text3").text; // grab the number of characters defined in shortTextLength and store them in the shortText variable shortText = fullText.substr(0, shortTextLength) +"..."; // set the contents of the text element to be the short text $w("#text3").text = shortText; }); export function mybutton_click(event, $w) { // make sure that you add the onClick event in properties // display the full text $w("#text3").text = fullText; // collapse the button $w("#button1").collapse(); } Thank you
The button position has been fixed yay! However when i click the button it wont show the rest of the text.
tried with the both types of code separately.
cheers
Write guys thanks a lot, I will give your advice a go! :)
@azharaonthenet , that's happening because you put the full text in the text-box (via the editor) and then when you push the short text pragmatically, the element below it stays where it is.
You should put the short-text (or even no text) in the text-box, and then assign the full text when it's needed.
Have you followed the tutorial correctly?
https://support.wix.com/en/article/corvid-tutorial-creating-a-show-more-link
Have a look at this previous forum post as I think it applies to what you are talking about.
https://www.wix.com/corvid/forum/community-discussion/expandable-text-box-w-show-more-button-issue
Code for the "Show More" Button
let fullText; // variable to hold the full text let shortText; // variable to hold the short version of the text $w.onReady(function () { // how many characters to include in the shortened version const shortTextLength = 40; // read the full text and store it in the fullText variable fullText = $w("#myTextElement").text; // grab the number of characters defined in shortTextLength and store them in the shortText variable shortText = fullText.substr(0, shortTextLength) + "..."; // set the contents of the text element to be the short text $w("#myTextElement").text = shortText; }); export function mybutton_click(event, $w) { //making sure that you have added the onClick event in properties // display the full text $w("#myTextElement").text = fullText; // collapse the button $w("#myButton").collapse(); }