When I hover a text with animation definitely I will use jQuery. Is there a code that will change the color, or size?
Asked
Active
Viewed 4.6e+01k times
4 Answers
377
Place the following in your jQuery mouseover
event handler:
$(this).css('color', 'red');
To set both color and size at the same time:
$(this).css({ 'color': 'red', 'font-size': '150%' });
You can set any CSS attribute using the .css()
jQuery function.

Annabelle
- 10,596
- 5
- 27
- 26
7
Or you may do the following
$(this).animate({color:'black'},1000);
But you need to download the color plugin from here.

Harry
- 87,580
- 25
- 202
- 214

Prog Mania
- 615
- 9
- 14
5
Nowadays, animating text color is included in the jQuery UI Effects Core. It's pretty small. You can make a custom download here: http://jqueryui.com/download - but you don't actually need anything but the effects core itself (not even the UI core), and it brings with it different easing functions as well.

Jonah
- 201
- 2
- 8
0
use CSS instead of jquery
transition:
div:hover {
transition: all 1s;
color: orange;
font-size: 150%;
}
<div>lorem</div>
<div>ippsum</div>
<div>dolor</div>
or different animation: CSS Tricks | 4 Ways to Animate the Color of a Text Link on Hover

Michal Miky Jankovský
- 3,089
- 1
- 35
- 36