• Post Reply Bookmark Topic Watch Topic
  • New Topic

display one first n number lines in the panel  RSS feed

 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i have a text in a span which is in a fixed height/width div, well, if the text has five lines, the third line already reach the bottom of the div, i would like to hide the fourth and fifth lines till user click a button, which will change the div height to "auto" to display all the text, is there any way to do that? I am using primefaces.

Thanks.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a click event on some sort of element and modify the DIV's height property in the event's callback:
 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Gregg. That is what I did, I could make the element (div) change the height (50px to auto) by clicking a button. The issue is that when div is 50px height, if i have 5 lines text, the fourth and fifth lines are below the bottom border, which i tried to hide it.

I tried using , which change the five lines to one line, not what i want for this case. I guess I need javascript method to calculate the charactor and show n charactor only at the height 50px, wondering if there is better ways to do it??
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!