I am very new to jquery. I am trying to change text color using jquery animate. But my code is not working. please anyone help me
<script>
$(p).hover(function(){
$(this).animate({"color":"red"})
})
</script>
To change the text color with jQuery, use the jQuery css() method. The color css property is used to change text color.
The background color animate can be performed with the help of the animate() function or css() function. The background color animate is used to set the background color of the selected elements.
The jQuery library provides several techniques for adding animation to a web page. These include simple, standard animations that are frequently used, and the ability to craft sophisticated custom effects.
Without using any additional plugin: I know this question is pretty old now but this is to help anyone still looking for a solution... here is a workaround without the need of any additional plugin.
jQuery css to change the color:
$("p").hover(function(){
$(this).css("color","red");
})
and CSS transition to replicate the animation effect when the color changes:
p {
color: black;
-webkit-transition: color 0.4s ease;
-moz-transition: color 0.4s ease;
-o-transition: color 0.4s ease;
transition: color 0.4s ease;
}
You can simply acheive it with Jquery UI. After adding simply
$( "#effect" ).animate({
backgroundColor: "#aa0000",
color: "#fff",
width: 500
}, 1000 );
http://jqueryui.com/animate/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With