Angular Side-to-Side Sliding Long Text Directive

Does anyone know the Angular directive for spreading long text when hovering over an HTML element? I prefer not to use the jQuery plugin if possible.

Currently the text is truncated using css, but I want to show the remaining characters to the user when hovering over it.

Any alternative solution is also welcome.

My Html:

<div class="name"><span>{{ field.name }}</span>

My CSS:

span {
     padding: 0 10px;
    font-size: 16px;
    font-weight: 100;
    line-height: 32px;
    text-overflow: ellipsis;
    overflow: hidden;
    display: block;
    white-space: nowrap;
    }
+4
source share
2 answers

The only alternative I know is to use CSS :

body{
  background-color: lightgrey;
}
.blue-btn{
  
  position:absolute;
  left:35%;
  top:40%;
}
.blue-btn a{
  color: white;
  text-decoration:none;
  margin-top: 0em;
  text-align: center;
  display:inline-block; /* important */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blue-btn, .first-link{
  -webkit-transition: 3.3s;
  -moz-transition: 3.3s;
  transition: 3.3s;     
  
  -webkit-transition-timing-function: linear;
  -moz-transition-timing-function: linear;
  transition-timing-function: linear;
}


.blue-btn{
  height: 64px;
  font: normal normal 700 1em/4em Arial,sans-serif;
  overflow: hidden;
  width: 200px;
  background-color: #3b5998;
}

.blue-btn:hover{
   background-color: #003D99;
}

.blue-btn a:hover{
  text-decoration: none;
}

.first-link{
  margin-left: 0em;   
}

.blue-btn:hover .first-link{
  margin-left: -300px;
}
<html>
  <body>
    <div class="blue-btn">
      <a class="first-link" href="">
      This is a very long text, it will take a long time to reach the end
      </a>
    </div>
  </body>
</html>  
Run codeHide result
0
source

Use CSS:

<style>
    span {
    padding: 0 10px;
    font-size: 16px;
    font-weight: 100;
    overflow-y: hidden;
    display: block;
    white-space: nowrap;
    width: 50px;
    }
 </style>
0

Source: https://habr.com/ru/post/1653651/


All Articles