Skip to content Skip to sidebar Skip to footer

A Href Is Not Going To Other Pages

I have this navigation menu that has few links to different part of the same index.html like a href='#about' or a href='#product' but when i put a href='reservation.html' it does n

Solution 1:

You need to know about relative path

/ root

./ current directory

../ parent of the current directory.

Try this,

<ahref="./index.html"><imgsrc="image/logo.png"></a>

Solution 2:

OK problem solved it seems that at the bottom of the index.html of this one-page template there is this line:

$(document).ready(function(){
  // Add smooth scrolling to all links in navbar + footer link
  $(".navbar a, footer a[href='#myPage']").on('click', function(event) {

    // Prevent default anchor click behavior
    event.preventDefault();

    // Store hashvar hash = this.hash;

    // Using jQuery's animate() method to add smooth page scroll// The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
    $('html, body').animate({
      scrollTop: $(hash).offset().top
    }, 900, function(){

      // Add hash (#) to URL when done scrolling (default click behavior)window.location.hash = hash;
    });
  });

the links as i guessed are prevented by default so i added an if statement saying:

if (".navbar a" =! ".external"){here goes the rest of li that have external links and now it works}

Solution 3:

Try using href="/reservation.html" if the exact link is www.website.com/reservation.html.

Post a Comment for "A Href Is Not Going To Other Pages"