开发者

How Facebook do to expand the text of a large post? Add a "... More" and expand it

I would like to know how to do something like Facebook does when you post a large text that shows you something like:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo venenatis nisl id convallis. Cum sociis natoque penatibus et m开发者_高级运维agnis dis parturient montes, nascetur ridiculus mus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis nec odio a libero consequat pretium ... More

So I can output all the text and, with jQuery, select a maximum of words, add the ... plus "More" and when I click it expand all the text remaining? All this without AJAX.

I will combine this with PHP for a multilingual site and I need to be able to change easily the word "More" for language support.

Sorry my English is not my main language and explain this is hard to me.

Thank you in advance!


There are many plugins out there to do this, the jQuery Expander plugin is one of the most popular. You can try out a demo here.

Or, there are lighter versions like truncate, you can try it here,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜