I am not a coder, and I am trying to resolve the slow loading time on one of my pages which contains profiles and write-ups of different people. They are all in a standard format in ‘boxes’ across the page. Currently we use a hover on every profile, and I suspect that is what is causing the slow loading time of the page.
Without using a repeater, is it possible to create a “see more” or “read more” function to expand and collapse the text for each profile?
I have actually not used a repeater before, but I’ve read up on it.
If I do use a repeater, is it possible to display say two lines of text by default then have a ‘see more’ option? How should I go about doing it?
Thanks for the quick reply!
Here’s a mock example below where I’ll have a page full of people’s profiles below (up to 200). It will have their profile picture, name, and a short write-up of their background.
Because the individual’s background write-up may be quite lengthy, I want to add a “read more” clickable link per profile, which is expandable. After expanding it, it can also be collapsible if I click on “read less”.
But don’t you use already a REPEATER?
Isn’t it a REPEATER on the PIC ?
Working without a repeater would be like the following…
You will have no REPEATER on your site, right?
That means, you will have a lot of single Text-fields on your site (i do not understand why you do not want to use repeaters, but this is your choice ^^) .
And your Textfields are surely connected with your database (dataset) ?
So you would have 2-different Text-Types —> SHORT & LONG.
Short-description and long description.
Either both of them in the DB, or the short one directly in the textfield.
I do not know all your set-up, i just assume it is like this.
But before i tell you how to do it, i would suggest you to go a completely another way and perhaps start to use REPEATERs.
The slow performance could also be caused, because you will surely have tons of elements on your page. -----> REPEATER = JUST one ELEMENT!
Repeaters can be directly controlled by datasets, for example of how much items you wanna show at once and how much should be added when expanding the data-view. Or you simply use the pagination-options of the dataset connected with ??? YES —> your REPEATER!
But perhaps i am thinking in a total wrong direction? (Just theoretical thoughts ^^).
Let me know more about your page-set-up and what do you think about my thoughts?
You’re totally right about that. We were just using lots of images and single text fields on the page put up one by one. None of us knew about repeaters until I stumbled on it.
I definitely prefer the repeaters as I just need to input the data there and it’s easily movable.
Can I create a clickable “Read/See more” link of the shortened desc instead of adding a button? So in this case i don’t have any Long Description, but I plug the whole chunk of text into the Shortened description. Then I limit the default view to just 2 shortened lines of text. Anything more than 2 lines of text, the viewer has to click “Read/see more”.
When you want to use a REPEATER, your next steps should be…
Creating a good prepared DATABASE, with all the needed data in it.
Since you will now use the REPEATER, you want have hundreds of elements on your site (which should improve enormaly the performance of your site).
All the action will be done by the REPEATER (which will take all data out of your database, where you will have stored all your text-parts / text-data and more).
You can imagine it like —> every-data-line in your database, will be an item showed in the repeater (single repeater-box), the same way, like shown on your linked pic…
My database will just have a short description column. No long description at all. So I want just the short description text to only display eg default 2 lines or 50 characters or so, and if the reader wants to read the whole short description, they will click that button of a special text, and the current description changes from the shortened version to the long version!
Yes correct! I’m looking for A CODE-Snipet to cut off my long-description automatically
Because having c reate 2-columns in my database (shortDescription / superShortDescription) will mean that I have to think of the length of the superShort description from the short description.
How should I proceed? I definitely want the easier way out…
And considering that I want to scale and put like 200 data in my database
This function you will find in the given link, i gave you before You did NOT look at it!
const shortTextTwoLength = 354;
// read the full text and store it in the fullTextTwo variable
fullTextTwo = $w("#text3").text;
// grab the number of characters defined in shortTextTwoLength and store them in the shortTextTwo variable
shortTextTwo = fullTextTwo.substr(0, shortTextTwoLength) + "...";
@russian-dima Let me try that out.
I went to your website but wasn’t sure the one I was looking at was the right one! I only saw the shortened text version, but did not see the ‘button’ to read more part.
Does this also allow the text to collapse after I’ve expanded it?
@russian-dima I created the repeater, and am just inputting the code as I follow some other online tutorials from other members. But so far I’ve not managed to get it running at all .
There’s no code on my web at all currently.
I couldn’t get your code running. Please see.
Here’s my mock database, with the short description and the long description