Home › Forums › CSS › [Solved] Add spacer to anchor link? › Reply To: [Solved] Add spacer to anchor link?
December 2, 2013 at 10:14 am
#157606
e6z6a6z
Participant
delete your javascript and try this:
$(document).ready(function() {
//Scroll Down Animation on Menu Click
$(‘a[href^=”#”]’).click(function(event) {
var id = $(this).attr(“href”);
var offset = 80;
var target = $(id).offset().top – offset;
$(‘html, body’).animate({scrollTop:target}, 1700);
event.preventDefault();
});
});
you can change the value of var offset=80;
and replace your back to top html with :
`
<a href="#content_wrap">Back to top</a>
`