1

This may be a stupid question but I've tried a couple things and can't seem to get it to work. I'm looking to simply add hard/external links to my current navigation, which is based on this.hash (it's a one-page site currently). The code is below:

jQuery(".tabs-btn ul li a, .navbar-nav li a, .navbar-brand").click(function (event) {
    event.preventDefault();
    //calculate destination place
    var dest = 0;
    if ($(this.hash).offset().top > $(document).height() - $(window).height()) {
        dest = $(document).height() - $(window).height();
    } else {
        dest = $(this.hash).offset().top;
    }
    //go to destination
    jQuery('html,body').animate({scrollTop: dest}, 1000, 'swing');
});

What needs to be changed/added to make this code accept external links and not just hash links? Thank you!

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
LM_
  • 11
  • 2

0 Answers0