mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-26 23:54:23 +01:00
Cosmetic changes in snippets.
This commit is contained in:
parent
7a9a8db7b1
commit
bbf8b768ef
@ -100,7 +100,7 @@ Note that closing an alert will remove it from the DOM.
|
||||
| `$().alert('close')` | Closes an alert by removing it from the DOM. If the `.fade` and `.show` classes are present on the element, the alert will fade out before it is removed. |
|
||||
| `$().alert('dispose')` | Destroys an element's alert. |
|
||||
|
||||
{% highlight js %}$(".alert").alert('close'){% endhighlight %}
|
||||
{% highlight js %}$('.alert').alert('close'){% endhighlight %}
|
||||
|
||||
### Events
|
||||
|
||||
@ -113,6 +113,6 @@ Bootstrap's alert plugin exposes a few events for hooking into alert functionali
|
||||
|
||||
{% highlight js %}
|
||||
$('#myAlert').on('closed.bs.alert', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -355,7 +355,7 @@ All carousel events are fired at the carousel itself (i.e. at the `<div class="c
|
||||
|
||||
{% highlight js %}
|
||||
$('#myCarousel').on('slide.bs.carousel', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
||||
|
@ -246,6 +246,6 @@ Bootstrap's collapse class exposes a few events for hooking into collapse functi
|
||||
|
||||
{% highlight js %}
|
||||
$('#myCollapsible').on('hidden.bs.collapse', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -904,6 +904,6 @@ All dropdown events are fired at the `.dropdown-menu`'s parent element and have
|
||||
|
||||
{% highlight js %}
|
||||
$('#myDropdown').on('show.bs.dropdown', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -115,7 +115,7 @@ Set heights using classes like `.form-control-lg` and `.form-control-sm`.
|
||||
Add the `readonly` boolean attribute on an input to prevent modification of the input's value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.
|
||||
|
||||
{% capture example %}
|
||||
<input class="form-control" type="text" placeholder="Readonly input here…" readonly>
|
||||
<input class="form-control" type="text" placeholder="Readonly input here..." readonly>
|
||||
{% endcapture %}
|
||||
{% include example.html content=example %}
|
||||
|
||||
|
@ -351,6 +351,6 @@ Updates the position of an element's popover.
|
||||
|
||||
{% highlight js %}
|
||||
$('#myPopover').on('hidden.bs.popover', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -340,6 +340,6 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
|
||||
|
||||
{% highlight js %}
|
||||
$('[data-spy="scroll"]').on('activate.bs.scrollspy', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -339,6 +339,6 @@ Hides an element's toast. Your toast will remain on the DOM but won't show anymo
|
||||
|
||||
{% highlight js %}
|
||||
$('#myToast').on('hidden.bs.toast', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -356,6 +356,6 @@ Updates the position of an element's tooltip.
|
||||
|
||||
{% highlight js %}
|
||||
$('#myTooltip').on('hidden.bs.tooltip', function () {
|
||||
// do something…
|
||||
// do something...
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
@ -65,9 +65,9 @@ $('.btn.danger').button('toggle').addClass('fat')
|
||||
All methods should accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):
|
||||
|
||||
{% highlight js %}
|
||||
$('#myModal').modal() // initialized with defaults
|
||||
$('#myModal').modal({ keyboard: false }) // initialized with no keyboard
|
||||
$('#myModal').modal('show') // initializes and invokes show immediately
|
||||
$('#myModal').modal() // initialized with defaults
|
||||
$('#myModal').modal({ keyboard: false }) // initialized with no keyboard
|
||||
$('#myModal').modal('show') // initializes and invokes show immediately
|
||||
{% endhighlight %}
|
||||
|
||||
Each plugin also exposes its raw constructor on a `Constructor` property: `$.fn.popover.Constructor`. If you'd like to get a particular plugin instance, retrieve it directly from an element: `$('[rel="popover"]').data('popover')`.
|
||||
@ -100,7 +100,8 @@ $('#myCarousel').carousel('2') // !! Will be ignored, as the transition to the s
|
||||
You can change the default settings for a plugin by modifying the plugin's `Constructor.Default` object:
|
||||
|
||||
{% highlight js %}
|
||||
$.fn.modal.Constructor.Default.keyboard = false // changes default for the modal plugin's `keyboard` option to false
|
||||
// changes default for the modal plugin's `keyboard` option to false
|
||||
$.fn.modal.Constructor.Default.keyboard = false
|
||||
{% endhighlight %}
|
||||
|
||||
## No conflict
|
||||
@ -109,7 +110,7 @@ Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In
|
||||
|
||||
{% highlight js %}
|
||||
var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
|
||||
$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality
|
||||
$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality
|
||||
{% endhighlight %}
|
||||
|
||||
## Version numbers
|
||||
|
Loading…
x
Reference in New Issue
Block a user