Tombol Bootstrap JS
Tombol JS (button.js)
Gunakan plugin ini jika Anda ingin memiliki kontrol lebih besar atas tombol Anda.
Untuk tutorial tentang Tombol, baca Tutorial Tombol Bootstrap kami .
Kelas Plugin Tombol
Kelas di bawah ini dapat digunakan untuk menata elemen <a>, <button>, atau <input> apa pun:
Class | Description | Example |
---|---|---|
.btn | Adds basic styling to any button | |
.btn-default | Indicates a default/standard button | |
.btn-primary | Provides extra visual weight and identifies the primary action in a set of buttons | |
.btn-success | Indicates a successful or positive action | |
.btn-info | Contextual button for informational alert messages | |
.btn-warning | Indicates caution should be taken with this action | |
.btn-danger | Indicates a dangerous or potentially negative action | |
.btn-link | Makes a button look like a link (will still have button behavior) | |
.btn-lg | Makes a large button | |
.btn-sm | Makes a small button | |
.btn-xs | Makes an extra small button | |
.btn-block | Makes a block-level button (spans the full width of the parent element) | |
.active | Makes the button appear pressed | |
.disabled | Makes the button disabled |
Melalui JavaScript
Aktifkan secara manual dengan:
$('.btn').button();
Opsi Tombol
None |
Metode Tombol
Tabel berikut mencantumkan semua metode tombol yang tersedia.
Catatan: Untuk plugin ini, metode juga dapat diteruskan melalui atribut data; tambahkan nama metode ke data-, seperti pada data-toggle atau data-loading.
Method | Description | Try it |
---|---|---|
.button("toggle") | Makes the button look pressed | |
.button("loading") | Disables the button and changes the button text to "loading..." | |
.button("reset") | Changes the button text to original text (if changed) | |
.button("string") | Specifies a new button text |
Lebih Banyak Contoh
Menggunakan CSS untuk Menyesuaikan Tombol
Cara menghapus batas bulat:
Contoh
.btn-default {
border-radius: 0;
}
Cara menambahkan warna tertentu:
Contoh
.btn-default {
background: #000;
color: #fff;
}
.btn-default:hover {
background: #fff;
color: #000;
}
Cara menambahkan bayangan:
Contoh
.btn-default {
box-shadow: 1px 2px 5px #000000;
}