feat: use bs-tooltip for img title

This commit is contained in:
Oliver Booth 2023-08-08 02:10:42 +01:00
parent 6583a8eba6
commit ea656f6513
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61

View File

@ -9,6 +9,13 @@ declare const katex: any;
} }
}); });
document.querySelectorAll("img[title]").forEach((img) => {
img.setAttribute("data-bs-toggle", "tooltip");
img.setAttribute("data-bs-placement", "bottom");
img.setAttribute("data-bs-html", "true");
img.setAttribute("data-bs-title", img.getAttribute("title"));
});
const list = document.querySelectorAll('[data-bs-toggle="tooltip"]'); const list = document.querySelectorAll('[data-bs-toggle="tooltip"]');
list.forEach((el: Element) => new bootstrap.Tooltip(el)); list.forEach((el: Element) => new bootstrap.Tooltip(el));