Link does not work when clicked

Asked

Viewed 4,355 times

1

I have this code from a menu and when clicked on the item Bio the link does not work:

<ul id="ul-menu">
 <li class="li-menu"><a class="scroll" href="http://www.iracemafilha.com">HOME</a></li>
 <li class="li-menu"><a class="scroll" href="http://www.iracemafilha.com/biografia">BIOGRAFIA</a></li>
 <li class="li-menu"><a class="scroll" href="#discografia">DISCOGRAFIA</a></li>
 <li class="li-menu"><a class="scroll" href="#fotos">FOTOS</a></li>
 <li class="li-menu"><a class="scroll" href="#videos">VIDEOS</a></li>
 <li class="li-menu"><a class="scroll" href="#agenda">AGENDA</a></li>
 <li class="li-menu"><a class="scroll" href="#convite">CONVITE</a></li>
 <li class="li-menu"><a class="scroll" href="#contato">CONTATO</a></li>
</ul>

CSS code:

#ul-menu {
   text-align: center;
   padding-top: 25px;
   word-spacing: 50px;
}

.li-menu {
    display: inline;    
    font-family: 'Abel', sans-serif;
 }

.li-menu a {
    color: white;
    text-decoration: none;
    font-size: 15px;
    background: #483D45;
    -moz-transition: all 0.2s linear;
    -webkit-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    transition: all 0.2s linear;
}

I already put the link destination in "href" but when I click will not.

  • This site http://www.iracemafilha.com is blacklisted as unsafe site... you can give more details what site is this and which links do not work?

  • Buddy, before I did the site I needed the hosting to create a fake study page for a "Safe Code Development" course at the College, but I’ve already removed all links and malicious files, I already sent a message to Google to remove the site from the list and make a new scam but not yet respond, I will have to register a new domain .com.br, but don’t worry that there is nothing malicious on the site, The problem is that Google has not yet removed the alert even removing all malicious files. Item iografia does not go to destination http://www.iracemafilha.com/biography

  • I tested in fiddle and it worked he redirected to page in the same tab, put soloque a taget="_Blank" to better see the redirect, be sure there is an element with id equal to href="#".

  • Ricardo, I am no longer using the navigation by anchors using Ids, I decided to make the individual pages anyway. I am referring to the first menu item "Biography", here it is not redirecting to the target.

  • What’s in the case /biografia? should be biografia.html? or .php? or maybe only one is missing / to be http://www.iracemafilha.com/biografia/. I won’t test more on your site and I don’t see how to reproduce this error to help more.

1 answer

5


In the <head> page, has a script:

jQuery(document).ready(function($) { 
    $(".scroll").click(function(event){        
        event.preventDefault();
        $('html,body').animate({scrollTop:$(this.hash).offset().top}, 200);
    });
});

Your link has the class scroll, so it is triggering the event configured in $(".scroll").click. The method event.preventDefault() stops link browsing. To fix, remove the preventDefault or remove the class scroll of the link.

Also, the script is giving the following error:

Uncaught Typeerror: Cannot read Property 'top' of null

  • Marcus Vinicius, I had really forgotten this script, just that I had even disabled the navigation by anchors on the same page and forgot the script. I’m gonna test.

  • It worked, thank you Marcus Vinicius, I thought that by not using the script it would be useless even not having the encounters.

Browser other questions tagged

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