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>
Related
I am starting to learn ember and try to incorporate some navigation bar using zurb foundation framework. I have a problem with dropdown menu. Check this link
<ul class="title-area">
<li class="name">
<h1>Home</h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<ul class="left">
<li class="has-dropdown">
{{#linkTo "about"}}About{{/linkTo}}
<ul class="vertical dropdown menu" data-dropdown-menu>
<li click>{{#linkTo "about.team"}}Team{{/linkTo}}</li>
</ul>
</li>
<li click>{{#linkTo "about.team"}}About/Team again{{/linkTo}}</li>
<li>{{#linkTo "contact"}}Contact{{/linkTo}}</li>
</ul>
</section>
I can not achive to trigger route when clicking on About/Team. When clicking on "About/Team again" then route works.
Any idea why this happens?
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>
Following is the html which I am using:
<div class="fixed contain-to-grid">
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<h1>Name</h1>
</li>
<li class="toggle-topbar menu-icon">
<span>Menu</span>
</li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li>Home</li>
<li><a href="#photo">Photos</li>
<li><a href="#video">Videos</li>
<li><a href="#blog">Blog</li>
<li><a href="#contact">Contact</li>
</ul>
</section>
</nav>
</div>
By default, it looks like this:
Home Photos Videos Blog Contact
When I am decreasing the size of my browser, it works fine and at the smallest, it turns into a hamburger menu.
But when I increase the size back to normal, the li tags don't line up as usual.
They appear something like this:
Home Photos
Videos Blog
Contact
What am I doing wrong?
There are known responsive-issues with foundation's top-bar.
But your top-bar looks very simple. Could work for you.
First try if fixing your html-markup eliminates the problem. You have missing </a>-tags.
See:
<li><a href="#photo">Photos</li>
<li><a href="#video">Videos</li>
<li><a href="#blog">Blog</li>
<li><a href="#contact">Contact</li>
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
});
});
I am currently working with foundation 5 and ultimately trying to make my page mobile friendly. I have a top navigation bar that I have created for the page following some of the basic structures. The navigation bar has problems being responsive. It does not display a menu at a all when I resize smaller the screen. How can I get the navigation bar to be responsive?
HTML:
<nav class="tab-bar show-for-small">
<a class="left-off-canvas-toggle menu-icon">
<span>Title</span>
</a>
</nav>
<nav class="top-bar docs-bar hide-for-small" data-topbar>
<ul class="title-area">
<li class="name">
<h1>
Title
</h1>
</li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li class="divider"></li>
<li class="has-dropdown not-click">
<a class="" href="#">Test</a>
<ul class="dropdown">
<li>
SubTest
</li>
</ul>
</li>
<li class="divider"></li>
<li class="has-dropdown not-click">
<a class="" href="#">Test2</a>
<ul class="dropdown">
<li>
SubTest2
</li>
</ul>
</li>
<li class="divider"></li>
<li class="has-dropdown not-click">
<a class="" href="#">Test3</a>
<ul class="dropdown">
<li>
SubTest3
</li>
</ul>
</li>
</ul>
</section>
</nav>
You have given it the class .hide-for-small for the main one which holds all of the dropdowns.
Then the one that is viewable by mobile, you have no data inside of it.
Add the <a class="left-off-canvas-toggle menu-icon">
<span>Title</span>
</a> to the other nav.
Refer to this page here to get a proper responsive topbar.