所以我在单独的文件中有一个页眉和页脚,我通过 php include 方法包含它们。在我的机器上,它适用于 chrome 和 edge。当我转到另一台电脑时,它可以在 chrome 上运行,但不能在 edge 上运行。现在,当它没有加载时,它实际上加载了,但之后直接消失了。它仅在屏幕上短暂闪烁。我的文件结构如下: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 关注
- 202 浏览
添加回答
举报
0/150
提交
取消