http://2012.delineamultimedia.com/#home_contact
I know this is a bit hacky but, I need this link and other anchor tags to do the same.
When going to this link the title of the page (section) is blocked off because of the fixed navigation is covering the content off…
I’m using the scrollto jQuery plugin and giving it a negative margin-top when it arrives to compensate for the fixed navigation… here is an example of that…
<script type="text/javascript">
$(function() {
$('ul.nav a').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top-139
}, 1500,'easeOutBounce');
event.preventDefault();
});
});
</script>
The problem is this only works when the scrollto function is triggered. So, I’ve been trying to do the following and I need help to get this to work so that when someone directly links to the hash tag http://2012.delineamultimedia.com/#home_contact or any others for that matter the page knows to move down extra space so that it clears the navigation.
<script type="text/javascript">
$(document).ready(function(){
function checkHash() {
if (location.hash === "#home_contact") {
navClick('#home_contact');
}
else if (location.hash === "#/index.html") {
navClick('index.html');
}
}
window.onhashchange = checkHash;
window.onload = checkHash;
});
</script>
The point of this is to activate the navItem when the hash link is clicked on. For some reason this isn’t working though, Can anyone help me get this to work? Thanks in advance for your time! I hope this makes sense, hard to explain.
I would piggyback on your existing functionality. Trigger a click event on your nav on page load.
In other words. Clicking on your nav already works, you can just reuse that functionality.