I need help, I'm building a one page layout webpage and I have a scroll to script but I want when I press the button in the nav bar class to appear. What I mean?
When ever I press a button it scrolls to the position but I want to see htttp://mysite.com/#top
This is what I have
$(function(){
$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body').animate({scrollTop: targetOffset - 100}, 800); /* Offest 100px because of the fixed nav manu */
return false;
}
}
});
});