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

265
Views
h1 element dissappears to the top when I use event listener and hover the mouse over text content

I wanna increase the height of the navbar with mouseover it, It is working fine when I hover over the nav element, but goes nuts when I actually hover over the text element of h1, I'm a beginner and images attached

<nav>
  <h1>My Page</h1>
</nav>

const nav = document.querySelector("nav");   

nav.addEventListener("mouseover", (event) => {
  event.target.classList.add("height100");
});

nav.addEventListener("mouseout", (event) => {
  event.target.classList.remove("height100");
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Just a side note, instead of using javascript to do that, try creating a CSS class on hover, like this:

#my-navbar {
  /*your navbar styles*/
}
#my-navbar:hover {
  /*your navbar styles when hovering over it*/
}
<nav id="my-navbar">
  <h1 id="my-navbar-title">My Page</h1>
</nav>
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!