Using CSS3 to implement animation in angular _angularjs

Source: Internet
Author: User

No more nonsense to say, directly to everyone to paste the example code.

See examples directly:

<! DOCTYPE html>  

With the introduction of the Angular-animate plug-in, we have bound the ng-if instruction, when the DOM node is deleted and added, angular adds the specified class for us to complete the animation.

. ng-enter
. ng-enter-active
. ng-leave
. ng-leave-active

Now look at the show and hide.

<! DOCTYPE html>  

. ng-hide-remove
. ng-hide-remove-active
. ng-hide-add
. ng-hide-add-active

The example we use is Ng-show, which belongs to display and hide. The previous example is Ng-if, which belongs to add and delete.

Looking back at the route we mentioned in the previous section, we can combine operations.

<! DOCTYPE html>  

This will have the effect of fading out when you switch pages.

Then review the previous chapters of the Baidu search:

<! DOCTYPE html>  

Through the cross-domain we get the data returned by Baidu, in turn, the transition is displayed on the page.


Here's a look at the example JS Animation:

<! DOCTYPE html>  

JS Animation We use JQ Animation library to complete, note that we use in the view of the ng-if, means to add and remove the DOM node, so we return Leave&enter in the controller.

JS Animation has a ng-if, nature is ng-show.

<! DOCTYPE html>  

The

Return Addclass&removeclass on the controller indicates hidden and displayed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.