Hello friend,

if you want to any anchor link click in html page and scroll a specific section or div please use this jquery code, this is very easy, put script code in javascript and put html code “call here” where your link and move or scroll target id set where reach to….

see example below:

 

<script>

$(document).on('click','.scrollto',function(){
event.preventDefault();
var defaultAnchorOffset = 0;
var anchor = $(this).attr('data-attr-scroll');
var anchorOffset = $('#'+anchor).attr('data-scroll-offset');
if (!anchorOffset)
anchorOffset = defaultAnchorOffset;

$('html,body').animate({
scrollTop: $('#'+anchor).offset().top - anchorOffset
}, 500);
});

</script>

HTML

Call here

<a href="#" data-attr-scroll="scrollup" class="scrollto" >Click Me</a>

Move to or scroll or specific div or section or set target

<div class="" id="scrollup" data-anchor-offset="-400"> Scroll Here</div>