我陷入了一个难题。我正在修改 Square Space 网站。我正在使用他们的测试版“开发者”模式;到目前为止,它似乎只允许 CSS 文件的源,所有内容都在其“ block ”或 .page/.block 内。在任何地方都找不到 .html 或 .php 文件。
所以我被困在他们的“代码注入(inject)区域”——以及页脚。我设置了页脚内容,但是页脚应该显示除主页之外的所有位置。我想知道你们中是否有人知道一种编写内联 JS 和/或 CSS 来仅隐藏主页页脚的方法;或者通过主页 URL?
<center>
<div>
<a class="footer" href="https://coolguys.squarespace.com/terms/">FAQ</a> •
<a class="footer" href="https://coolguys.squarespace.com/green/">GREEN</a> •
<a class="footer" href="https://coolguys.squarespace.com/wholesale/">WHOLESALE</a> •
<a class="footer" href="https://manbearpigs.squarespace.com/links/">LINKS</a>
<br>
<span>Hello World</span>
</div>
使用纯 CSS 来完成此操作是最可取的。
我发现了这个:
body.page-id-777 td#footer {
display:none;
}
但不确定页面 URL 等如何;可以转换为页面 ID。
最佳答案
使用纯 js 可以很容易地做到这一点。
if (document.url == "http://squarespace.com") {
document.getElementsByClassName("footer")[0].style.display = 'none';
}
关于javascript - 如果主页(或某个页面/URL)隐藏页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20364496/