Przycisk Bootstrap JS


Przycisk JS (button.js)

Użyj tej wtyczki, jeśli chcesz mieć większą kontrolę nad przyciskami.

Aby zapoznać się z samouczkiem dotyczącym przycisków, przeczytaj nasz samouczek dotyczący przycisków Bootstrap .


Klasy wtyczek przycisków

Poniższe klasy mogą służyć do stylizowania dowolnego elementu <a>, <button> lub <input>:

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

Przez JavaScript

Włącz ręcznie za pomocą:

$('.btn').button();


Opcje przycisków

None

Metody przycisków

W poniższej tabeli wymieniono wszystkie dostępne metody przycisków.

Uwaga: W przypadku tej wtyczki metody można również przekazywać za pośrednictwem atrybutów danych; dołącz nazwę metody do data-, jak w data-toggle lub 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

Więcej przykładów

Używanie CSS do dostosowywania przycisków

Jak usunąć zaokrąglone obramowania:

Przykład

.btn-default {
  border-radius: 0;
}

Jak dodać konkretny kolor:

Przykład

.btn-default {
  background: #000;
  color: #fff;
}

.btn-default:hover {
  background: #fff;
  color: #000;
}

Jak dodać cienie:

Przykład

.btn-default {
  box-shadow: 1px 2px 5px #000000;
}