Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
long text 4 lines and in last line if have ellipsis add "Read more" link , it's possible?

I need to display text from array I did it with ng-repeat and when the text bigger then 4 lines add ellipsis and link view more I did the ellipsis and also function that return if there are ellipsis and then I display link but its going down a row. I wanna find way to do it... the situation now I would love for you to help me. Attached is html,js code

  <div class="comment1 aop-ellipssis four">
            {{item.description}}
          </div>
          <span ng-if="c.isOverflown('comment1',$index)" ng-click="c.openLink(item.sys_id)" class="ag-link" >View More</span>



`   function _isOverflown(elem,index){
    var element = angular.element('.'+elem)[index];
    return element.scrollHeight > element.clientHeight ;}
`

This is what I did but can not raise the view more Because I have defined width and according to that I am shown the three points

I need such a result

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

here is a possible average trick , keep some space for that link and set it in absolute position inside a relative parent where stands the text to clamp :

demo below , that fails to hide the motre link if text is filling partially the last line without ellipsis.


edit : to match your screenshot you added, javascript is there for such a job, CSS won't help I'll leave the answer here for curiosity only. :)


div {
  width: 400px;
  margin: 1em auto 0;
  line-height: 1.4;
  border-top: solid;
  padding-bottom: 1.4em;/* == line-height */
  position: relative; /* for coordonate reference to position the more link */
  overflow:hidden;/* hide a if here and  too far from top */
}

div p { /* text-clipping*/
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 0;
}

div p+a {
  position: absolute;
  top: 4.2em;/* == line-height x line-clamp  */
  right:1rem;
  background:#bee
}
<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
    Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus
    lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor,
    facilisis luctus, metus</p><a href="#">more</a>
</div>
<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p><a href="#">more</a>
</div>

<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet.</p><a href="#">more that should not be seen </a>
</div>
<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
    Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. </p><a href="#">more</a>
</div>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda