Вот мой код JS для веб -страницы < /p>
Код: Выделить всё
// Load navbar and footer into every page
document.addEventListener("DOMContentLoaded", () => {
// Load the navbar
fetch("navbar.html")
.then((res) => res.text())
.then((data) => {
document.getElementById("navbar").innerHTML = data;
});
// Load the footer
fetch("footer.html")
.then((res) => res.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Wait for the DOM to fully load before initializing Turn.js
const flipbook = document.querySelector(".flipbook");
// Ensure the flipbook exists before initializing Turn.js
if (flipbook) {
const initializeFlipbook = () => {
const screenWidth = window.innerWidth;
// Adjust flipbook size based on screen width
let flipbookWidth = 800;
let flipbookHeight = 500; // Default aspect ratio: 16:10
if (screenWidth
Подробнее здесь: [url]https://stackoverflow.com/questions/79595570/flipbook-only-working-in-inspect-element-mode-and-on-mobile-but-not-on-laptop[/url]