Skip to content

Commit cf86a22

Browse files
committed
Fix autoplay of carousels when embedded in a card
fixes #647
1 parent ea0f608 commit cf86a22

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Easier json handling in databases without a native json type. SQLPage now detects when you use a json function in SQLite or MariaDB to generate a column, and automatically converts the resulting string to a json object. This allows easily using components that take json parameters (like the new columns component) in MariaDB and SQLite.
88
- Add a new optional `database_password` configuration option to set the password for the database connection separately from the connection string. This allows to keep the password separate from the connection string, which can be useful for security purposes, logging, and avoids having to percent-encode the password in the connection string.
99
- New `initial_search_value` property in the table component to pre-fill the search bar with a value. This allows to display the table rows that will initially be filtered out by the search bar.
10+
- Fix autoplay of carousels when embedded in a card.
1011

1112
## 0.29.0 (2024-09-25)
1213
- New columns component: `columns`. Useful to display a comparison between items, or large key figures to an user.

sqlpage/sqlpage.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,16 @@ add_init_fn(sqlpage_table);
204204
add_init_fn(sqlpage_map);
205205
add_init_fn(sqlpage_card);
206206
add_init_fn(sqlpage_form);
207-
add_init_fn(load_scripts);
207+
add_init_fn(load_scripts);
208+
209+
function init_bootstrap_components(event) {
210+
if (window.bootstrap) {
211+
const fragment = event.target;
212+
fragment.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(el => new bootstrap.Tooltip(el));
213+
fragment.querySelectorAll('[data-bs-toggle="popover"]').forEach(el => new bootstrap.Popover(el));
214+
fragment.querySelectorAll('[data-bs-toggle="dropdown"]').forEach(el => new bootstrap.Dropdown(el));
215+
fragment.querySelectorAll('[data-bs-ride="carousel"]').forEach(el => new bootstrap.Carousel(el));
216+
}
217+
}
218+
219+
document.addEventListener('fragment-loaded', init_bootstrap_components);

0 commit comments

Comments
 (0)