Pages

Tuesday, 10 March 2020

Animate an element in jQuery

The following jQuery code animates a square box by sliding it across the webpage after clicking a button.
Screenshot of button and square to animate
Screenshot of button and square to animate
The blue square is created by using CSS styling. Clicking the button then applies the 'animate' method to the #square 'div' moving it a set distance across the webpage (800px in this example) at a speed of 1 second.

Animate an element in jQuery.html

No comments:

Post a comment