What i'm after is when I hover over an element with the ID #work, I want the background to animate into a different color. Hence this code:
$("#work").on('mouseenter', function() {
$(".wrapper").animate( {"background-color": '#EF6C00'});
})
And when the mouse doesn't hover over the element and leaves, i want it to go back to it's original color. Hence this code:
$("#work").on('mouseleave', function() {
$(".wrapper").animate( {"background-color": '#395eb0'});
})
Now to my problem. When i'm trying to tell jQuery that when I click on the element, It should keep the color it's animating to. Which simply doesn't work at all. Here's the full code:
$("#work").on('mouseenter', function() {
$(".wrapper").animate( {"background-color": '#EF6C00'});
})
$("#work").on('mouseleave', function() {
$(".wrapper").animate( {"background-color": '#395eb0'});
})
$("#work").on('click', function() {
$(".wrapper").css("background-color", '#EF6C00');
});