LoginSignup
4
4

More than 5 years have passed since last update.

velocity.jsでfadein animationなどを使用してた場合にレイアウトが崩れる原因

Posted at

velocity.jsを使用している際に、
「fadeInさせた要素が何故かレイアウト崩れちゃう!」
ということがありませんか?

なかなか無いと思います。
ですが備忘録として書いておきます。

原因

これはvelocity.jsでのfadeInなど、表示させる系のanimationは、指定したDOMにdisplay:block;のstyleを付与するために起こることが多いです。
(自分はこれで2回時間を喰わされました。)

対処法

  1. display:flexなどのプロパティをつけている要素をanimationのtargetにしない
  2. .velocity().css('display','inline');などでdisplayの上書きをする
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4