Skip to content
Advertisement

FadeInLeft effect when changing content

JavaScript
JavaScript
JavaScript

How can I get the FadeInLeft effect when changing content from .opacity=0 to .opacity=1 on the left side.
I tried to solve this problem with the given script, but it did not work for me.
P.S. See this layout in fullscreen.

Advertisement

Answer

Here is a very ruff first draft

Since you already have the .active class being added to your .subtitle class to change opacity, you can just tack on CSS Animation to those classes.

In my example I have .subtitle > div set to right: 100%; and .active > div set to right: 0%; with a transition: 300ms;

Which will animate the block from the left side of the screen over to the right side in 300ms. You can play around with this until you get the animation where you’d like.

Here’s a great article from MDN with more information about Using CSS Transitions

CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time. For example, if you change the color of an element from white to black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized.

Examples

JavaScript

JavaScript

JavaScript

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement