所以我在單獨的文件中有一個頁眉和頁腳,我通過 php include 方法包含它們。在我的機器上,它適用于 chrome 和 edge。當我轉到另一臺電腦時,它可以在 chrome 上運行,但不能在 edge 上運行?,F在,當它沒有加載時,它實際上加載了,但之后直接消失了。它僅在屏幕上短暫閃爍。我的文件結構如下:2.10.0 index.php assets headernav.php在我的 index.php 文件中,我使用此代碼來包含。<?php include("assets/headernav.php"); ?>它包含的headernav.php文件如下<script> function openmen() { document.getElementById("menu").style.marginLeft = "0"; document.getElementById('menubtn').setAttribute("onClick", "closemen()"); document.getElementById("content").style.paddingLeft = "250px"; document.getElementById("searchbox").style.left = "240px"; } function closemen() { document.getElementById("menu").style.marginLeft = "-230px"; document.getElementById('menubtn').setAttribute("onClick", "openmen()"); document.getElementById("content").style.paddingLeft = "20px"; document.getElementById("searchbox").style.left = "10px"; } function opensettings() { document.getElementById("settings").style.display = "block"; } function closesettings() { document.getElementById("settings").style.display = "none"; } </script><settings_background id="settings"><settings><h2>Instellingen</h2><i id="closebtn" onclick="closesettings()" class="fas fa-times"></i>所以總而言之,我包含的 headernav 文件在某些機器上使用 php 工作,而在其他機器上則直接加載和消失。
1 回答

慕無忌1623718
TA貢獻1744條經驗 獲得超4個贊
所以我找到了一個解決方案......終于。
原來有 position:fixed 的 header 總是需要 top:0;和 left:0;,即使標題已經在正確的位置。
- 1 回答
- 0 關注
- 221 瀏覽
添加回答
舉報
0/150
提交
取消