スタイル遷移プロパティ
例
div要素にカーソルを合わせると、外観が徐々に変化します。
document.getElementById("myDIV").style.transition = "all 2s";
定義と使用法
遷移プロパティは、4つの遷移プロパティの省略形のプロパティです。
transitionProperty、transitionDuration、transitionTimingFunction、およびtransitionDelay。
注:常にtransitionDurationプロパティを指定してください。指定しない場合、期間は0になり、遷移は効果がありません。
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
transition | 26.0 | 10.0 | 16.0 | 6.1 3.1 WebkitTransition |
12.1 |
構文
遷移プロパティを返します。
object.style.transition
遷移プロパティを設定します。
object.style.transition = "property duration timing-function delay|initial|inherit"
プロパティ値
Value | Description |
---|---|
transitionProperty | Specifies the name of the CSS property the transition effect is for |
transitionDuration | Specifies how many seconds or milliseconds the transition effect takes to complete |
transitionTimingFunction | Specifies the speed curve of the transition effect |
transitionDelay | Defines when the transition effect will start |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | すべて0イーズ0 |
---|---|
戻り値: | 要素の遷移プロパティを表す文字列 |
CSSバージョン | CSS3 |
関連ページ
CSSリファレンス:遷移プロパティ
❮スタイルオブジェクト