所以我在單獨(dú)的文件中有一個頁眉和頁腳,我通過 php include 方法包含它們。在我的機(jī)器上,它適用于 chrome 和 edge。當(dāng)我轉(zhuǎn)到另一臺電腦時,它可以在 chrome 上運(yùn)行,但不能在 edge 上運(yùn)行。現(xiàn)在,當(dāng)它沒有加載時,它實(shí)際上加載了,但之后直接消失了。它僅在屏幕上短暫閃爍。我的文件結(jié)構(gòu)如下: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 文件在某些機(jī)器上使用 php 工作,而在其他機(jī)器上則直接加載和消失。
1 回答

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