O'Reilly logo

Moodle JavaScript Cookbook by Alastair Hole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving an element along a straight path

An element can be repositioned by moving it along a straight path by animating a change in its X and Y position on the page. In this recipe, we will animate the moving of a container div element 200 pixels to the right.

Here, we can see the key steps in this animation by looking at a selection of frames:

Moving an element along a straight path
Moving an element along a straight path
Moving an element along a straight path

How to do it...

We begin by creating a PHP page to set up a basic Moodle programming environment. In this case, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required