Active Links for UL Navbar and JQuery
Permalink
I am still having trouble crafting a scrolling navbar that uses active links at the top level of a drop down menu. My current code for the navbar is:
<script language="javascript" type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
});
</script>
<ul class="navbar2"><li id="imglink">
<a id="imglink" class="scroll" href="#TopAnchor">
<img src="http://bmpbuild.com/concrete/files/4413/7476/2680/Logo.png" height="100%" width="100%" title="Top">
</a>
</li>
</ul>
<ul class="navbar">
<li><a class="scroll" href="#ProductsAnchor">Our Products</a></li><li><a class="scroll" href="#CapabilitiesAnchor">Capabilities</a></li>
<li><a class="scroll" href="#AboutAnchor">About Benchmark</a><ul><li> <a class="scroll" href="#PeopleAnchor">Our People</a></li>
<li><a class="scroll" href="#PressResearchAnchor">Press / Research</a>
</li></ul>
</li></ul>
My site is located at:
http://bmpbuild.com/concrete
What code(jQuery and CSS) can I add to not interrupt the scroll function and add active links?
Thanks,
Jared
Also if someone could identify why there is a random white bar between some #Fittings (I have tried to clean up my code to no avail) that would be great.
<script language="javascript" type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
});
</script>
<ul class="navbar2"><li id="imglink">
<a id="imglink" class="scroll" href="#TopAnchor">
<img src="http://bmpbuild.com/concrete/files/4413/7476/2680/Logo.png" height="100%" width="100%" title="Top">
</a>
</li>
</ul>
<ul class="navbar">
<li><a class="scroll" href="#ProductsAnchor">Our Products</a></li><li><a class="scroll" href="#CapabilitiesAnchor">Capabilities</a></li>
<li><a class="scroll" href="#AboutAnchor">About Benchmark</a><ul><li> <a class="scroll" href="#PeopleAnchor">Our People</a></li>
<li><a class="scroll" href="#PressResearchAnchor">Press / Research</a>
</li></ul>
</li></ul>
My site is located at:
http://bmpbuild.com/concrete
What code(jQuery and CSS) can I add to not interrupt the scroll function and add active links?
Thanks,
Jared
Also if someone could identify why there is a random white bar between some #Fittings (I have tried to clean up my code to no avail) that would be great.
Active Class, untested:
Your structure of the code is incorrect. All scripts and meta-tags must within the head-tag.