I'm having a strange problem with my links inside "li" tags...
<div class="header">
<div class="navigation">
<ul class="nav nav-justified">
<li><a href="index.php#sobreLnk" class="scroll">SOBRE NÓS</a>
</li>
<li><a href="index.php#produtosLnk" class="scroll">PRODUTOS</a>
</li>
<li id="headings">
<a href="#heading" class="scroll">
<img src="./img/logo.png">
</a>
</li>
<li><a href="index.php#ondeLnk" class="scroll">ONDE COMPRAR</a>
</li>
<li><a href="index.php#contato" class="scroll">CONTATO</a>
</li>
</ul>
</div>
</div>
For some reason, when I click on the links, nothing happens at all.
The links are correct, the index.php page is on the same directory, and the anchors do exist and work just fine on the index.php page.
Thanks in advance.
答案 0 :(得分:3)
更改散列片段(#
之后的部分)不会导致页面重新加载,因为该片段仅在客户端中可用。如果您希望重新加载页面,则需要将URL从index.php
更改为其他内容,从而向服务器发出实际请求。
答案 1 :(得分:0)
他们似乎工作得很好。这段代码是index.php的一部分吗?如果正文没有延伸到窗口底部以外,页面将不会向下滚动,因此看起来它没有做任何事情。
当我添加一些空间时,它们工作正常。
<html>
<head>
<meta charset="utf-8">
<title>Just Playing</title>
<style media="screen">
.giveSpace{
font-weight: bold;
min-height: 500px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="navigation">
<ul class="nav nav-justified" style="margin-bottom:300px;width:100%;">
<li><a style="font-size:17px;font-family:Montserrat;" href="index.php#sobreLnk" class="scroll">SOBRE NÓS</a></li>
<li><a style="font-size:17px;font-family:Montserrat;" href="index.php#produtosLnk" class="scroll">PRODUTOS</a></li>
<li id="headings"><a style="color:white;font-size:17px;font-family:Montserrat;" href="#heading" class="scroll"><img src="./img/logo.png" style="width:auto;height:auto;"></a></li>
<li><a style="font-size:17px;font-family:Montserrat;" href="index.php#ondeLnk" class="scroll">ONDE COMPRAR</a></li>
<li><a style="font-size:17px;font-family:Montserrat;" href="index.php#contato" class="scroll">CONTATO</a></li>
</ul>
</div>
</div>
</div>
<div id="sobreLnk" class="giveSpace">
sobreLnk
</div>
<div id="produtosLnk" class="giveSpace">
produtosLnk
</div>
<div id="heading" class="giveSpace">
heading
</div>
<div id="ondeLnk" class="giveSpace">
ondeLnk
</div>
<div id="contato" class="giveSpace">
contato
</div>
</body>