I am trying to reveal some truncated text on hover. The text will all be dynamic so each li will be different lengths of text.
The ideal situation would be to hover the truncated text, it slides to reveal the full length of the text and ends at the end.
I have created something that is close to what I need, except I cant figure out how to remove all the extra space at the end of the shorter text on the right when hovered, and how to get it to show all the text on the longer ones (they seem to get cut off)
Here is the HTML:
<ul>
<li>
<a class="link" href="#">Example of really long blog title goes here</a>
</li>
<li>
<a class="link" href="#">Example of really long blog title goes here - this is a longer text</a>
</li>
<li>
<a class="link" href="#">Example of really long blog title goes here - this is an even longer length to test</a>
</li>
</ul>
And the CSS
ul {
width:200px;
overflow:hidden;
background:#f2f2f2;
}
.link {
display:block;
white-space: nowrap;
width:auto;
transform: translateX(0%);
transition: 4s ease-in-out;
}
.link:hover {
color:red;
transform: translateX(-100%);
}
Any help as to what I'm missing will be so appreciated!