Jump to content
Search Community

Problem with onMouseEnter and onMouse

camiloignaval test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

Hello! I have the following problem with onmouseEnter and onmouseLeave in react, when I move the mouse slowly it works without problems, but when I move the mouse quickly the images remain large, I don't understand please, if you could help me please, thank you very much

I will leave a video with the sample, since I did not put it in codepen, and the code, thank you very much!

 

pd: if you could help me if it is possible, that when you do mouseEnter, it stays in the middle of the screen and when you do mouseLeave, return to the position, but since it works with e.target, I have not been able to do it with the timeline play and reverse (). I tried anyway but I didn't succeed

 

const onEnter = (e) => {
		setNombreLogo(e.target.alt);
		nameLogo.current.classList.add("mostrar");
		e.target.classList.add("activo");
		gsap.to(e.target, 1, {
			opacity: 1,
			rotate: 360,
			scale: 2,
			duration: 1,
			ease: "power3.in",
		});
	};
	const onLeave = (e) => {
		nameLogo.current.classList.remove("mostrar");
		e.target.classList.remove("activo");
		gsap.to(e.target, {
			opacity: 1,
			rotation: "-360",
			scale: 1,
			duration: 0.5,
		});
	};

 

<h1 className='titleSkill titleFront pl-5 '>FRONTEND</h1>
			<div className='iconosFront d-flex row'>
				{front.map((logo) => (
					<img
						onMouseEnter={onEnter}
						onMouseLeave={onLeave}
						key={logo}
						className='iconoFront'
						src={`../../assets/${logo}.png`}
						alt={logo}
					/>
				))}
			</div>

Video problem

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...