mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-17 14:54:30 +01:00
parent
57e045f0ab
commit
398ddedac7
@ -281,8 +281,8 @@ You can activate a list group navigation without writing any JavaScript by simpl
|
||||
Enable tabbable list item via JavaScript (each list item needs to be activated individually):
|
||||
|
||||
```js
|
||||
$('#myList a').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
$('#myList a').on('click', function (event) {
|
||||
event.preventDefault()
|
||||
$(this).tab('show')
|
||||
})
|
||||
```
|
||||
@ -384,8 +384,8 @@ If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will
|
||||
</table>
|
||||
|
||||
```js
|
||||
$('a[data-toggle="list"]').on('shown.bs.tab', function (e) {
|
||||
e.target // newly activated tab
|
||||
e.relatedTarget // previous active tab
|
||||
$('a[data-toggle="list"]').on('shown.bs.tab', function (event) {
|
||||
event.target // newly activated tab
|
||||
event.relatedTarget // previous active tab
|
||||
})
|
||||
```
|
||||
|
@ -820,7 +820,7 @@ Bootstrap's modal class exposes a few events for hooking into modal functionalit
|
||||
</table>
|
||||
|
||||
```js
|
||||
$('#myModal').on('hidden.bs.modal', function (e) {
|
||||
$('#myModal').on('hidden.bs.modal', function (event) {
|
||||
// do something...
|
||||
})
|
||||
```
|
||||
|
@ -526,8 +526,8 @@ You can activate a tab or pill navigation without writing any JavaScript by simp
|
||||
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
|
||||
|
||||
```js
|
||||
$('#myTab a').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
$('#myTab a').on('click', function (event) {
|
||||
event.preventDefault()
|
||||
$(this).tab('show')
|
||||
})
|
||||
```
|
||||
@ -645,8 +645,8 @@ If no tab was already active, then the `hide.bs.tab` and `hidden.bs.tab` events
|
||||
</table>
|
||||
|
||||
```js
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
e.target // newly activated tab
|
||||
e.relatedTarget // previous active tab
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (event) {
|
||||
event.target // newly activated tab
|
||||
event.relatedTarget // previous active tab
|
||||
})
|
||||
```
|
||||
|
@ -48,9 +48,9 @@ Bootstrap provides custom events for most plugins' unique actions. Generally, th
|
||||
All infinitive events provide [`preventDefault()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) functionality. This provides the ability to stop the execution of an action before it starts. Returning false from an event handler will also automatically call `preventDefault()`.
|
||||
|
||||
```js
|
||||
$('#myModal').on('show.bs.modal', function (e) {
|
||||
$('#myModal').on('show.bs.modal', function (event) {
|
||||
if (!data) {
|
||||
return e.preventDefault() // stops modal from being shown
|
||||
return event.preventDefault() // stops modal from being shown
|
||||
}
|
||||
})
|
||||
```
|
||||
@ -80,7 +80,7 @@ All programmatic API methods are **asynchronous** and return to the caller once
|
||||
In order to execute an action once the transition is complete, you can listen to the corresponding event.
|
||||
|
||||
```js
|
||||
$('#myCollapse').on('shown.bs.collapse', function (e) {
|
||||
$('#myCollapse').on('shown.bs.collapse', function (event) {
|
||||
// Action to execute once the collapsible area is expanded
|
||||
})
|
||||
```
|
||||
@ -88,7 +88,7 @@ $('#myCollapse').on('shown.bs.collapse', function (e) {
|
||||
In addition a method call on a **transitioning component will be ignored**.
|
||||
|
||||
```js
|
||||
$('#myCarousel').on('slid.bs.carousel', function (e) {
|
||||
$('#myCarousel').on('slid.bs.carousel', function (event) {
|
||||
$('#myCarousel').carousel('2') // Will slide to the slide 2 as soon as the transition to slide 1 is finished
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user