Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
3d tranforming/animating individual characters/words in a paragraph

I would like to animate portions of a paragraph. If I transform my p tag it transforms the entire box.

I've seen this done before and I'm kicking myself for not saving the stackoverflow answer to it, and now I've been searching for an answer for over an hour and can't seem to find it or any way to solve it.

Basically, I'd like the letters that the cursor hover over to pop out from the text some. I thought this could be done with CSS but javascript is welcome as well.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use JavaScript to wrap each letter in a span, then apply your styling when span:hover. The JavaScript below does this for each letter that isn't a space.

var text = document.getElementById('jump').innerHTML;
var result = '';
for (var i = 0; i < text.length; i++) {
    var char = text.substring(i, i + 1);
    if (char == ' ') {
        result += char;    
    } else {
        result += '<span>' + char + '</span>';
    }
    
}
document.getElementById('jump').innerHTML = result;
p#jump {
    line-height: 30px;

}
#jump span:hover {
    display: inline-block;
    transform: translateY(-10px);
}
<p id="jump">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!