Properti transisi gaya
Contoh
Arahkan kursor ke elemen div untuk mengubah tampilannya secara bertahap:
document.getElementById("myDIV").style.transition = "all 2s";
Definisi dan Penggunaan
Properti transisi adalah properti singkatan untuk empat properti transisi:
transisiProperty, transisiDuration, TransitionTimingFunction, dan TransitionDelay.
Catatan: Selalu tentukan properti TransitionDuration, jika tidak durasinya adalah 0, dan transisi tidak akan berpengaruh.
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Property | |||||
---|---|---|---|---|---|
transition | 26.0 | 10.0 | 16.0 | 6.1 3.1 WebkitTransition |
12.1 |
Sintaksis
Kembalikan properti transisi:
object.style.transition
Setel properti transisi:
object.style.transition = "property duration timing-function delay|initial|inherit"
Nilai properti
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 |
Detail Teknis
Nilai Bawaan: | semua 0 mudah 0 |
---|---|
Nilai Kembali: | Sebuah String, mewakili properti transisi dari suatu elemen |
Versi CSS | CSS3 |
Halaman Terkait
Referensi CSS: properti transisi
Objek Gaya