Problem with url

0

I made a page where all the content is in it (there are no other pages). I had to adapt a kind of friendly url in it, because by clicking on the sections of the page, the cursor goes to the certain point. It's working properly, but it gets a # in the url.

$("a.menu__item").on('click', function(event) {

  if (this.hash !== "") {

    event.preventDefault();

    var hash = this.hash;

    $('html, body').animate({
      scrollTop: $(hash).offset().top
    }, 800, function() {

      window.location.hash = hash;

    });
  }
});

I managed to get the #

$("a.menu__item").on('click', function(event) {

  if (this.hash !== "") {

    event.preventDefault();

    var hash = this.hash;

    $('html, body').animate({
      scrollTop: $(hash).offset().top
    }, 800, function() {

      history.pushState(null, null, 'a.menu__item');
      if (history.pushState) {
        var url_a = hash.substring(1, hash.length);
        history.pushState(null, null, url_a);
      } else {
        location.hash = url_a;
      }
    });
  }
});

However, your self opens the page in client / blog, says that the page does not exist. Is it better to leave the # or is it plausible any idea for the problem of opening the page and it does not exist?

    
asked by anonymous 02.10.2018 / 20:35

0 answers