I am using following jquery code for my one page portfolio my site http://www.hettzdesigns.com
but when page loads it directly goes to contact section of site instead of index section.
Can anyone tell where it is going wrong.
$(document).ready(function(){
$('nav ul li a').click(function(){
var el = $(this).attr('href');
var elWrapped = $(el);
scrollToDiv(elWrapped,140);
return false;
});
function scrollToDiv(element,navheight){
var offset = element.offset();
var offsetTop = offset.top;
var totalScroll = offsetTop-navheight;
$('body,html').animate({
scrollTop: totalScroll
}, 650);
}
});
It's because you're giving autofocus
to your form fields which makes your fields automatically get focus when the page loads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With