Link to an external page does not work

Asked

Viewed 84 times

0

In the page menu www.wrccdesign.com.br, the link BLOG which is an external link that should lead to another page, does not work, that is, when clicking anything happens. I’d like to know how to solve the problem. I did some tests, and from what I noticed a JS is affecting the functionality.

  • 3

    Hi Wagner, welcome to Stack Overflow. Post the relevant portion of the problem code (for example, the tag <a> and the Javascript code that is interfering)

1 answer

0


This function of yours is blocking:

$('.templatemo-top-menu .navbar-nav a').click(function(e){
    e.preventDefault(); 
    var linkId = $(this).attr('href');
    scrollTo(linkId);
    if($('.navbar-toggle').is(":visible") == true){
        $('.navbar-collapse').collapse('toggle');
    }
    $(this).blur();
    return false;
});

Notice, when you use the e.preventDefault(); it prevents the event of click be continued. You have several ways to solve this problem, I think the best would be to specify the links you want to call this function, as follows:

Add the class inpage for all menus that scroll on the page:

<a href="#templatemo-about" class="inpage">SOBRE</a>

Those who will open externally you leave as it is:

<a href="http://www.wrccdesign.com.br/blog/" target="_blank">BLOG</a>

And then add an . Inpage at the end of your function selector:

$('.templatemo-top-menu .navbar-nav a.inpage')
  • 1

    I got confused in my answer, this should solve.

  • 1

    AEEE! IT WORKED! puts! thanks really! thanks to the guys who commented too!

  • @Wagnerrosati, if the answer helped you, mark it as a solution, so that other people who have the same problem can also be helped!

  • @Juniornunes7 man, thank you, how can I mark the answer?

  • @Wagnerrosati on the left side of this answer has two arrows, one down and one up, underneath these arrows have a V, just click on it. You can read more here: http://meta.pt.stackoverflow.com/a/1079/57573

  • cool, already clicked...talking about UX, I found a little "hidden" this "v" not hinting that it is for this purpose... hugs! thank you!

  • Agree with you @Wagnerrosati, thanks!

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.