Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning AngularJS Animations

You're reading from   Learning AngularJS Animations Enhance user experience with awesome animations in AngularJS using CSS and JavaScript

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher
ISBN-13 9781783984428
Length 182 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Keller Keller
Author Profile Icon Keller
Keller
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Getting Started FREE CHAPTER 2. Understanding CSS3 Transitions and Animations 3. Creating Our First Animation in AngularJS 4. JavaScript Animations in AngularJS 5. Custom Directives and the $animate Service 6. Animations for Mobile Devices 7. Staggering Animations 8. Animations' Performance Optimization Index

JavaScript animations as a fallback for CSS animations

We might have to create animations for browsers that do not have support for CSS animations and transitions yet. It might be part of a project's requirements.

In this case, we can still use JavaScript animations as a fallback for CSS animations. However, what if we add a CSS animation and a JavaScript animation for the same element and the browser has support for CSS animations?

We don't want to display the same animation twice, so we will use Modernizr, a JavaScript library that detects HTML5 and CSS3 features in the user's browser.

Note

Learn more about Modernizr at http://modernizr.com.

In such cases, we will trigger the JavaScript animations only if CSS transitions are not supported by the browser.

Here, we have a sample of the ngIf animation that uses a transition if the browser has support for CSS transitions; otherwise, it triggers the JavaScript animation fallback with the same animation effect, shown as follows:

&lt...
lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning AngularJS Animations
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon