8000 Fix/bootstrap turbo docs · symfony/symfony-docs@771dac3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 771dac3

Browse files
Kerrialnjaviereguiluz
authored andcommitted
Fix/bootstrap turbo docs
1 parent 7017e75 commit 771dac3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

frontend/encore/bootstrap.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,25 @@ Now, require bootstrap from any of your JavaScript files:
7373
$('[data-toggle="popover"]').popover();
7474
});
7575
76+
Using Bootstrap with Turbo
77+
---------------------------
78+
79+
If you are using bootstrap with Turbo Drive, to allow your JavaScript to load on each page change,
80+
wrap the initialization in a ``turbo:load`` event listener:
81+
82+
.. code-block:: javascript
83+
84+
// app.js
85+
86+
// this waits for Turbo Drive to load
87+
document.addEventListener('turbo:load', function (e) {
88+
// this enables bootstrap tooltips globally
89+
let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
90+
let tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
91+
return new Tooltip(tooltipTriggerEl)
92+
});
93+
});
94+
7695
Using other Bootstrap / jQuery Plugins
7796
--------------------------------------
78< 3AAB /td>97

0 commit comments

Comments
 (0)
0