I have a fixed navigation up top:
<div class="navigation">
<ul>
<li><a href="#" id="toggle1" class="contentdown">HOME</a></li>
<li><a href="#" id="toggle2" class="contentdown">ABOUT</a></li>
<li class="logo"><img src="images/ogsystemslogo.png" /></li>
<li>CAREERS</li>
<li><a href="#" id="toggle3" class="contentdown">CONTACT</a></li>
</ul>
</div>
When I click on the "contact" target, it expands a div just above the start of my content area. My problem is this is great if the user is at the top of the page, if the user is say, scrolled down to the middle, the div will still work but the user will not know what is happening as the div isn't in view. My question is how do I get this target to work anywhere on the page where the user can see it? Another way to put it is, if the user is at the bottom of a long page and clicks on the contact button, how do I get the page to shoot up to where the content is so the user can see it?
I have tried this:
added an ID () just under the tag but above the fixed navigation in hopes that the javascript here would work:
$("#test").click(function () { $('html, body').animate({ scrollTop: $("#uptop").offset().top }, 1000); });
but this doesn't work.
I also have this in my script:
$(document).ready(function () {
$(this).scrollTop(0);
});
so that when the page refreshes it shoots up to the top.
Is there a goTo function I could write that would make this work? Since the navigation is being used to open another div, I am not sure if I can link each link to two separate functions.
<div class="toggle3" style="display: none;">
<div class="toggle3main">
<div class="wrapper">
<div class="map">
</div>
</div>
</div>
</div>
Here is the JS:
$(function () {
$('#toggle3').click(function () {
$('.toggle3').show('1000');
$('.toggle2').hide('1000');
$('.toggle1').hide('1000');
$('.toggle').text('toggle 3 clicked');
$('.toggle').slideToggle('1000');
return false;
});
});