How is the "click to view more" function implemented?
- by bobo
We often see websites that display first few lines of an article and then append ... [More] so that people who are interested in can click on it to view the full article.
To implement this functionality, we first need to find out where the article text should be cut to append the ... [More].
Since there must be some HTML/ CSS coupled with the article text, we must remember to ignore them when calculating the length of the text.
But there is something I just can't figure it out, if more than one language is mixed in the first few lines of the article text, the length of the text will be very difficult to calculate since the characters can be of variable length.
How should we solve this problem?