HTML UL LI a href links not working - html

I am working on a website and for the menu I have the following code:
<header>
<div class="sticky-nav">
<a id="mobile-nav" class="menu-nav" href="#menu-nav"></a>
<nav id="menu">
<ul id="menu-nav">
<li>Home
</li>
<li>Clubs
</li>
<li>Campaigns
</li>
<li>Movement
</li>
<li>Events
</li>
<li>The Talk
</li>
<li>Resources
</li>
<li>Donate
</li>
<li>#Aevidum
</li>
<li>Contact
</li>
</ul>
</nav>
</div>
</header>
But when I click on the home link it doesn't go anywhere or do anything. Anyone know what the issue could be?
Here is a link to the directory I'm working on it in: http://aevidum.com/brushed/

I think some java-script or jquery function is overriding your current functionality, because the code which you posted works fine without any includes.
<header>
<div class="sticky-nav">
<a id="mobile-nav" class="menu-nav" href="#menu-nav"></a>
<nav id="menu">
<ul id="menu-nav">
<li>Home
</li>
<li>Clubs
</li>
<li>Campaigns
</li>
<li>Movement
</li>
<li>Events
</li>
<li>The Talk
</li>
<li>Resources
</li>
<li>Donate
</li>
<li>#Aevidum
</li>
<li>Contact
</li>
</ul>
</nav>
</div>
</header>

I guess you may be using the Brushed Template by Alessio Atzeni?
I had the same problem. Below is the full nav section I have, and where I added a class 'linkfix_LogIn' to the link I needed to be not a relative anchor.
<header>
<div class="sticky-nav">
<a id="mobile-nav" class="menu-nav" href="#menu-nav"></a>
<div id="logo">
<a id="goUp" href="#home-slider" title="Home">Home</a>
</div>
<nav id="menu">
<ul id="menu-nav">
<li class="current">Home</li>
<li>What Is This</li>
<li>Contact</li>
<li class="linkfix_LogIn">Outside Link</li>
</ul>
</nav>
</div>
</header>
Also in the main.js file, amend the following inside this function:
BRUSHED.listenerMenu = function(){
And add this little method at the bottom:
// Fix outside links.
$('.linkfix_LogIn a').on('click',function() {
window.location.href = "http://www.YourURL.com"; // Change This
});

If you use "Brushed Template by Alessio Atzeni", It seems to be caused by "plugin.js".
Get "jquery.nav.js" from the following page.
https://github.com/davist11/jQuery-One-Page-Nav
Then overwrite the code of "jQuery One Page Nav Plugin" in the last part of "plugin.js" (near the 30th line to the end) with the contents of "jquery.nav.js".
I was able to solve the same problem in this way.
I hope this helps someone.

Issue might be with the jquery come with your template. If nothing worked out use a javascript onclick function on the 'href' tag to redirect
onclick="window.open('https://www.yoursite.com/mypage')"
If you want to mention the target type use this instead
onclick="window.open('https://www.yoursite.com/mypage', '_blank')"

I had the same problem. I just added diplay: block on the a tag. It's worked for me!
ul li a {
display: block;
}

Proceed like this everything is gonna work perfectly .
<ul class="nav-links">
<li> Home</li>
<li> Tours</li>
<li> Explore </li>
<li>About</li>
</ul>

Related

Links don't work in Materialize tabs

I'm relatively new to web development, and I'm using Materialize for the project I'm working on right now. My navbar code is attached, for some reason I can click on and follow the links in the sidebar, but not in the nav-content tabs. When I take out the tabs tabs-transparent classes in the ul, it works, but it looks ugly. I am loading JQuery- that was the only resolution I saw to this problem when I googled.
<nav class="blue-grey lighten-1 nav-extended" role="navigation">
<div class="nav-wrapper">
<a id="logo-container" href="#" class="brand-logo center"><img src="/application/static/application/colorondarknotext.png" height=60px/></a>
<ul class="right hide-on-med-and-down">
<li><a class="dropdown-button" href="#!" data-activates="dropdown1">Welcome, (USERNAME)!<i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
<ul id="nav-mobile" class="side-nav">
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li>
<a class="collapsible-header">Welcome, (USERNAME)!<i class="material-icons right">arrow_drop_down</i></a>
<div class="collapsible-body">
<ul>
<li>Account Info</li>
<li>Log Out</li>
</ul>
</div>
</li>
</ul>
</li>
<li>
<div class="divider"></div>
</li>
<li>Application</li>
<li>Decisions</li>
<li>Travel Information</li>
</ul>
<i class="material-icons">menu</i>
</div>
<div class="nav-content hide-on-med-and-down">
<ul class="tabs tabs-transparent">
<li class="tab">Application</li>
<li class="tab">Decisions</li>
<li class="tab">Travel Information</li>
</ul>
</div>
</nav>
I've run into a series of issues like this.
Generally you need to look deeper in the docs. In this case the navbar component docs don't address the issue in their example code. You need to look under javascript>tabs section of the docs to uncover more details about how the tabs work.
http://materializecss.com/tabs.html#external
By default, Materialize tabs will ignore their default anchor behaviour. To force a tab to behave as a regular hyperlink, just specify the target property of that link!
The normal anchor (<a>) functionality is disabled/ignored. In order to make your links work like "normal" you need to add a target attribute to your links.
Assuming you want to open the links in the same window, you would add target="_self" to each <a> tag.
<li class="tab">Application</li>
<li class="tab">Decisions</li>
<li class="tab">Travel Information</li>

Gap above navigation bar?

Since adding a slide show into my site I now have a odd gap above my navigation bar. I am not sure on how to fix this. I tried what I did last time I had this happening but nothing ...
I have a JSfiddle set up: https://jsfiddle.net/7yj8rkbe/
HTML (for my nav bar):
<img src="img/Logo.png" id="logo">
<li>
Other
<ul>
<li>About</li>
<li>Contact</li>
</ul>
</li>
<li>
Store
<ul>
<li>Official</li>
<li>Community</li>
</ul>
</li>
<li>
Projects
<ul>
<li>Official</li>
<li>Community</li>
<li>Open Source</li>
</ul>
</li>
<li>
Forum
<ul>
<li>Programming</li>
<li>Technology</li>
<li>Gaming</li>
</ul>
</li>
<li>
<a id="nav-home" href="#">Home</a>
</li>
</ul>
#information {
top: 0;
}
You specified fixed positioning to that div but you forgot to set top value.

Twitter Bootstrap - Make "scrollspy" trigger a bit sooner

I am using Twitter Bootstrap 3.2.0 and the nifty scrollspy feature in it. It works fine for me. I just have a long menu on the right side, and it is set to be affixed, and it corresponds to a huge amount of text. This functions without an issue with the following code;
Questions
Without data-offset-top="60", it doesn't 'stay put' right. I don't understand why this is.
I would like to make it 'trigger' sooner. Right now, a <div> with the corresponding id has to be almost all the way to the top of the page for the matching menu item to get 'highlighted'. Is it possible to make this a bit quicker, maybe where it will trigger when it is around 200px from the top?
HTML
<div class="row">
<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
<!-- all of my page contents here, with appropriate "id" set on each to correspond -->
</div>
<div class="col-lg-3 col-md-3 hidden-sm hidden-xs" data-offset-top="60" data-spy="affix" data-theme-role="sidebar" id="sidebar-menu">
<ul class="nav sidenav">
<li class="active">
alpha
<ul class="nav">
<li>
alpha[1]
</li>
</ul>
</li>
<li>
beta
</li>
<li>
gamma
<ul class="nav">
<li>
gamma[1]
</li>
<li>
gamma[2]
</li>
<li>
gamma[3]
</li>
</ul>
</li>
<li>
delta
<ul class="nav">
<li>
delta[1]
</li>
<li>
delta[2]
</li>
</ul>
</li>
<li>
epsilon
<ul class="nav">
<li>
epsilon[1]
</li>
<li>
epsilon[2]
</li>
</ul>
</li>
<li>
zeta
<ul class="nav">
<li>
zeta[1]
</li>
<li>
zeta[2]
</li>
</ul>
</li>
<li>
eta
<ul class="nav">
<li>
eta[1]
</li>
<li>
eta[2]
</li>
</ul>
</li>
<li>
theta
<ul class="nav">
<li>
theta[1]
</li>
<li>
theta[2]
</li>
</ul>
</li>
</ul>
</div>
</div>
I had similar issues,
1- The data-offset-top kind of tells the affix plugin when to get started....so how far down the user scrolls until it needs to affix the div you have set up.
something that might work better than just a hard coded number, 60, is to set up the affix in javascript, rather than the attributes of the HTML element. and when you set the offset, you can get the exact starting position of the element, and then have the affix only kick in after that location has been scrolled past.
$('#sidebar-menu').affix({ //this sets up the affix plugin
offset: $('#sidebar-menu').position().top //this gets the exact
//location of the div and only starts to affix after that
});
when you use the javascript method, you should take out the
data-offset-top="60" data-spy="affix"
2- The data offset should work, again, maybe try the javascript version
$(document).ready(function() {
$('body').scrollspy({
target: '#sidesummary',
offset: 100
});
});

Foundation 5 - top bar menu icon not visible

I'm working on a site using the latest version of Foundation 5 SASS (downloaded a few days ago from https://github.com/zurb/bower-foundation).
When I create a top bar the menu-icon (the 3 horizontal lines) doesn't appear on mobile/small screens. It's just the 'MENU' text.
Here is my code:
<div class="contain-to-grid">
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name"></li>
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<ul class="left">
<li>HOME</li>
<li class="has-dropdown">
ROOMS & FACILITIES
<ul class="dropdown">
<li>FIRST</li>
<li>SECOND</li>
<li>THIRD</li>
</ul>
</li>
<li>PRICES</li>
<li>THINGS TO DO</li>
<li>CONTACT</li>
</ul>
<ul class="right">
<li class="show-for-medium-up"><i class="fi-calendar calendar-icon"></i> CHECK AVAILABILITY</li>
</ul>
</section>
</nav>
</div>
Any help greatly appreciated. I've had a good look around already and can't find a solution. Most of the problems seemed to be from people omitting the span tags around the Menu text.
Thanks
the main thing is to have a <span> element. In the case of 2 examples below, the first one will NOT show the hamburger icon, but the second and the third one will.
<li class="toggle-topbar menu-icon ">Menu</li>
<li class="toggle-topbar menu-icon "><span>Menu</span></li>
<li class="toggle-topbar menu-icon "><span></span></li>
<li class="toggle-topbar menu-icon">
<span>MENU</span>
</li>
This works fine with latest (5.5.3) version
The menu-icon class should be in the tag.
<li class="toggle-topbar"><a class="menu-icon" href="#"><span>Menu</span></a></li>
There's a Foundation fix for this here which worked for me, for the top bar menu icon at least.

unordered list navigation html structure

I'm a novice and ran my code through an html validator.
Regarding my navigation I receive a message that reads: :Element ul not allowed as child of element ul in this context"
Here is the html structure:
<nav>
<div class="nav_container">
<ul class="navigation">
<ul class="logo">
<li><img src="images/rh_logo_v5.png" alt="roundhaus logo"/></li>
</ul>
<ul class="subnav">
<li>home</li>
</ul>
<ul class="subnav">
<li>reclaimed wood</li>
<li>design</li>
</ul>
<ul class="subnav">
<li>flooring</li>
<li>paneling</li>
<li>beams</li>
</ul>
<ul class="subnav">
<li>shelving
</li><li>mantels</li>
</ul>
<ul class="subnav">
<li>news</li>
</ul>
<ul class="subnav">
<li>wood types</li>
<li>phrases</li>
</ul>
</ul>
</div>
</nav>
Whats wrong with it? It looks fine across browsers. Should I be concerned or take action?
A ul can not be a direct child of another ul, it needs to be contained within an li
<ul class="navigation">
<li>
<ul class="logo">
<li><img src="images/rh_logo_v5.png" alt="roundhaus logo"/></li>
</ul>
</li>
<li>
<ul class="subnav">
<li>home</li>
</ul>
</li>
<li>
<ul class="subnav">
<li>reclaimed wood</li>
<li>design</li>
</ul>
</li>
<li>
<ul class="subnav">
<li>flooring</li>
<li>paneling</li>
<li>beams</li>
</ul>
</li>
<li>
<ul class="subnav">
<li>shelving</li>
<li>mantels</li>
</ul>
</li>
<li>
<ul class="subnav">
<li>news</li>
</ul>
</li>
<li>
<ul class="subnav">
<li>wood types</li>
<li>phrases</li>
</ul>
</li>
</ul>
you could also give the menu some headings by adding it in the li before the child ul,
you must wrap each of the inner ul with an li
<ul class="navigation">
<li>
<ul>
<li>...</li>
</ul>
</li>
<li>
<ul>
<li>...</li>
</ul>
</li>
<li>
<ul>
<li>...</li>
</ul>
</li>
</ul>
Your structure is likely wrong. Logo is not a list or list-item. As well as list item that contains just another list is generally pointless.
Use heading element for logo (I usually use H1 for home page and H3 with link inside it for other pages):
<!-- for home page -->
<h1 id="logo">Company</h1>
<!-- for other pages -->
<h3 id="logo">Company</h3>
And make sure that your navigation has correct hierarchy like this:
<ul>
<li>Products
<ul>
<li>Desktops</li>
<li>Laptops</li>
<li>Tablets</li>
</ul>
</li>
<li>About
<ul>
<li>History</li>
<li>Contacts</li>
</ul>
</li>
</ul>
In the example, each LI has its own link and subsections of section that the link represents, and thus the link text is heading for subsections' list.
You need to wrap
<ul class="navigation">
<ul class="logo">
as
<ul class="navigation">
<li>
<ul class="logo">
...
</ul>
</li>
and so on...