Home > OS >  Why my link won't navigate me to the page that i want? However my cursor shows that it is click
Why my link won't navigate me to the page that i want? However my cursor shows that it is click

Time:10-13

This is the website that I need to fix

https://www.glamiva.com/2021/09/its-been-while.html

Why the "HOME","ABOUT","SERVICES","CLIENTS","RECENT POSTS","CONTACT ME" button doesn't bring me to the page that it supposed to bring?

Only "Contact Me" is working at the moment

CodePudding user response:

Scrolling via the nav bar is a combo of html and css.

<h1 id="about">About</h1> You need to give the div or section an id.

<a href="#about" style="color:white;">About</a> The nav bar then needs to have an href that points to that id. You style how it scrolls/jumps with css.

CodePudding user response:

Please use this navbar instead of current one.

<ul class="nav navbar-nav navbar-right">
<!-- Top Nav -->
<li><a class="" href="https://www.glamiva.com/#home" onclick="window.location.href=this.href" rel="nofollow">HOME</a></li>
<li><a href="https://www.glamiva.com/#about" onclick="window.location.href=this.href" rel="nofollow">ABOUT</a></li>
<li><a href="https://www.glamiva.com/#services" onclick="window.location.href=this.href" rel="nofollow">SERVICES</a></li>
<li><a href="https://www.glamiva.com/#clients" onclick="window.location.href=this.href" rel="nofollow">CLIENTS</a></li>
<li><a href="https://www.glamiva.com/#work" class="active" onclick="window.location.href=this.href" rel="nofollow">RECENT POSTS</a></li>
<li><a href="/#contact">CONTACT ME</a></li>
</ul>

CodePudding user response:

The anchor elements in the navigation bar have a function in the onclick event that calls the event.preventDefault() method, thus blocking the loading of the URL defined in the href property of the anchor tag.
Unfortunately I could not locate the script or snippet of code that does this. Perhaps it is a plugin or addon devoted to the handling of internal links.
I could only add a second onclick function through the developer tools of the browser checking the value of the event.isDefaultPrevented property and that it is set to true. I also disabled javascript and could see that the link in this case work properly.
Probably that script check if the

That said, you could try the following to unlock the situation:

  1. Locate the script that blocks the url to load and try not to apply (if this has no other unwanted consequenses), thus restoring the default behaviour of the anchor tag
  2. If the previous point is not possible, then use the solution proposed by Satu Tareku as is or adapted to your needs. That solution works because it does not deal with the block, but circumvents it by loading the url via javascript. This is more a hack than a solution and it is not ideal if you have to apply it on several pages.
  • Related