Keyframe background change on click?

Keyframe background change on click?
0

#1

So i’ve gone through the keyframes and for the most part understood those, however im wanting to do a background color transition on my “Quote Machine” : http://codepen.io/msmith1114/pen/ryRWRy

right now im doing a simple background change on click:

$("body").css("background-color", newcolor);

Where newcolor is just pulling randomly from an array of color hex values.

Since I can’t really just set the CSS keyframes to constantly change, how would I accomplish this on click? I want it to be a sort of slowish transition so it’s not an instant color change.


#2

You can consider using the jQuery Colour plugin, which allows you to animate background colour as follows:

    $(".quote-container").animate({
        backgroundColor: "salmon"
    });

Good luck! :slight_smile: