mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-19 16:54:24 +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):
|
Enable tabbable list item via JavaScript (each list item needs to be activated individually):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$('#myList a').on('click', function (e) {
|
$('#myList a').on('click', function (event) {
|
||||||
e.preventDefault()
|
event.preventDefault()
|
||||||
$(this).tab('show')
|
$(this).tab('show')
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -384,8 +384,8 @@ If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$('a[data-toggle="list"]').on('shown.bs.tab', function (e) {
|
$('a[data-toggle="list"]').on('shown.bs.tab', function (event) {
|
||||||
e.target // newly activated tab
|
event.target // newly activated tab
|
||||||
e.relatedTarget // previous active tab
|
event.relatedTarget // previous active tab
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -820,7 +820,7 @@ Bootstrap's modal class exposes a few events for hooking into modal functionalit
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$('#myModal').on('hidden.bs.modal', function (e) {
|
$('#myModal').on('hidden.bs.modal', function (event) {
|
||||||
// do something...
|
// 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):
|
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$('#myTab a').on('click', function (e) {
|
$('#myTab a').on('click', function (event) {
|
||||||
e.preventDefault()
|
event.preventDefault()
|
||||||
$(this).tab('show')
|
$(this).tab('show')
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -645,8 +645,8 @@ If no tab was already active, then the `hide.bs.tab` and `hidden.bs.tab` events
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (event) {
|
||||||
e.target // newly activated tab
|
event.target // newly activated tab
|
||||||
e.relatedTarget // previous active 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()`.
|
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
|
```js
|
||||||
$('#myModal').on('show.bs.modal', function (e) {
|
$('#myModal').on('show.bs.modal', function (event) {
|
||||||
if (!data) {
|
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.
|
In order to execute an action once the transition is complete, you can listen to the corresponding event.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$('#myCollapse').on('shown.bs.collapse', function (e) {
|
$('#myCollapse').on('shown.bs.collapse', function (event) {
|
||||||
// Action to execute once the collapsible area is expanded
|
// 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**.
|
In addition a method call on a **transitioning component will be ignored**.
|
||||||
|
|
||||||
```js
|
```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
|
$('#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