Pulsante Bootstrap JS
Pulsante JS (pulsante.js)
Usa questo plugin se vuoi avere un maggiore controllo sui tuoi pulsanti.
Per un tutorial sui pulsanti, leggi il nostro tutorial sui pulsanti Bootstrap .
Le classi di plugin per pulsanti
Le classi seguenti possono essere utilizzate per definire lo stile di qualsiasi elemento <a>, <button> o <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 |
Tramite JavaScript
Abilita manualmente con:
$('.btn').button();
Opzioni pulsante
None |
Metodi dei pulsanti
La tabella seguente elenca tutti i metodi disponibili con i pulsanti.
Nota: per questo plugin, i metodi possono anche essere passati tramite attributi di dati; aggiungere il nome del metodo a data-, come in data-toggle o 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 |
Altri esempi
Utilizzo dei CSS per personalizzare i pulsanti
Come rimuovere i bordi arrotondati:
Esempio
.btn-default {
border-radius: 0;
}
Come aggiungere un colore specifico:
Esempio
.btn-default {
background: #000;
color: #fff;
}
.btn-default:hover {
background: #fff;
color: #000;
}
Come aggiungere le ombre:
Esempio
.btn-default {
box-shadow: 1px 2px 5px #000000;
}