At once setting of the CSS property and the event "mouseover/mouseout"

Joined
Jul 12, 2024
Messages
2
Reaction score
0
JavaScript:
document.querySelectorAll('.name a h1').forEach(el => {
     el.style.color = 'blue';

     el.addEventListener('mouseenter', () => {
         el.style.color = 'red';  });
     el.addEventListener('mouseleave', () => {
         el.style.color = 'yellow';  });
 });
  1. How to set a color correctly: for a text or for a link?
  2. 'mouseenter' act on a text or around link ?
  3. Is this even a working design?
will it work or not? Or are the principles of JS violated here ?

If "to comment" 2 line, then working only 'mouseout' . Why ?
At the same time, in different situations, without 2 line, work either 'mouseenter' or 'mouseleave' turn on.
I can't understand the system.

(picture - is slider, for a beauty)

Swiper3Dslider All is reproduced. see in DevTools, use OVERRIDES . file --- show.js
 

Attachments

  • slider.jpg
    slider.jpg
    63.8 KB · Views: 0

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top