I'm just beginning to learn jQuery and I'm trying to change the colour of a piece of text on my webpage when the user scrolls. the piece of text is contained within a div id. The name of the div I am using in my CSS sheet is #headerTitle.
Here is the code I have so far:
$(document).ready(function(){
$(window).scroll(function(){
$("#headerTitle").backgroundColor({
transition:"background-color": "green"
});
}
}
backgroundColor, you will see that no such method exists. It's good that you tried something, but reading the documentation beforehand saves you from going in the wrong direction. You can change CSS via api.jquery.com/css and the property that controls the text color iscolor. Learn how to debug JavaScript.