Current location - Training Enrollment Network - Mathematics courses - Front-end basic skills: JS (1 1) animation packaging (CSS style acquisition, JSON traversal)
Front-end basic skills: JS (1 1) animation packaging (CSS style acquisition, JSON traversal)
The original position of the box was 0+ 10, and now the box is offset by 10.

|-5| = 5

These three functions are all mathematical functions.

mathematics

Such as the console. Journal (math. Ceil (1.0 1)) gets 2.

Console. Journal (math. Ceil (1.9)) result 2

Console. Journal (math. The result of Ceil (- 1.3)) is-1.

For example, the result of console.log (math.floor (1 .01)) is1.

Console.log (math.floor (1 .9)) result1.

The result of console.log (math.floor (-1.3)) is -2.

The result of console.log (math.round (1 .01)) is1.

The result of console.log (math.round (1.9)) is 2.

The principle of uniform animation: the position of the box itself+step size

Principle of slow-motion animation: the position of the box itself+step size (constantly changing)

(Disadvantages: only horizontal! The following "Individual attributes of encapsulated mobile frames will be further improved").

We access css properties, which are usually used in two ways:

Point grammar can get the width attribute and the top attribute * * in units. 100px

However, this grammar has a very big flaw, which cannot be changed.

There is no way to pass parameters after width and top.

Var w = width;

box.style.w

The biggest advantage: you can pass parameters to properties.

We want to get css styles, box.style.left and box.style.backgorundColor

But you can only get the style in the line.

But we mostly use embedded or external links in our work.

What should we do?

Core: How can we get the style of embedded or external chain?

External (using

Two options are required, and no pseudo class is replaced by null.

There are many attributes in our element, the upper left width = = =

If we want a property, we should return it, and all functions that continue to encapsulate and return to the current style should return it.

Be sure to remember the meaning of each item: it is quite important.

Signs are generally judged as switches in js.

The callback function to be executed after the animation is completed.

How do we know the animation is finished?

It's simple. When the timer stops. The animation is over.

Case source code:

The in operator is also a binary operator, but the requirements for the left and right operands of the operator are strict. The in operator requires that the 1 (left) th operand must be a string type or other types that can be converted into string types, and the second (right) operand must be an array or an object. Only when the value of the 1 th operand is the attribute name of the second operand will it return true, otherwise it will return false.

Case source code:

Link: /s/ 1miEvqoo

Password: 7fv8