How to make scrolling after running the script?

There are step-by-step opening and closing blocks
Ie the user enters data in 1 unit, clicks next, there is 2 block, etc.
But the problem is that the blocks have a different height and at the transition to the next block, the page is moved down to the end of the trail block. Question: how to make so that after the transition to the next unit, the screen rose up before the start of the block?

// Show step
 $('.points li').click(function(){
if(!$(this).hasClass('active')){
 var numberItem = $(this).attr('class').substr(5);
 $('.points li').removeClass('active');
$(this).addClass('active');
$('.step').hide();
 $('.step' + numberItem).show();
}
});
 $('.navigation_links .prev').click(function(e){
e.preventDefault();
 var numberItem, prevNumber;
$(this).parents('.steps').find('.points').find('li').each(function(){
if($(this).hasClass('active')){
 numberItem = $(this).attr('class').substr(5,1);
}
});
 if(numberItem != 1){
 prevNumber = numberItem - 1;
$('.step').hide();
 $('.step' + prevNumber).show();
 $('.points li').removeClass('active');
 $('.point' + prevNumber).addClass('active');
}
});
 $('.navigation_links .next').click(function(e){
e.preventDefault();
 var numberItem, nextNumber;
$(this).parents('.steps').find('.points').find('li').each(function(){
if($(this).hasClass('active')){
 numberItem = $(this).attr('class').substr(5,1);
}
});

 if(numberItem != 7){
 nextNumber = Number(numberItem) + 1;
$('.step').hide();
 $('.step' + nextNumber).show();
 $('.points li').removeClass('active');
 $('.point' + nextNumber).addClass('active');
}
});
 var flag = false;

$('.country').click(function(){

if(!$(this).hasClass('active')){
$(this).addClass('active');
}else{
$(this).removeClass('active');
}
$('.country').each(function(){
 bool1 = false;
if($(this).hasClass('active')){
 bool1 = true;
 return false;
}
});
 if(bool1) {
 $('.step3 .onwards').addClass('active');
}
else{
 $('.step3 .onwards').removeClass('active');
}
});
$('.onwards').click(function(){
 $('.navigation_links .next').click();
});

$('.onwarz').click(function(){
 $('.navigation_links .prev').click();
});

 var bool1 = true;
$('.revised').click(function(){
if(!$(this).hasClass('active')){
$(this).addClass('active');
}else{
$(this).removeClass('active');
}
$('.revised').each(function(){
 bool1 = false;
if($(this).hasClass('active')){
 bool1 = true;
 return false;
}
});
 if(bool1) {
 $('.step5 .onwards').addClass('active');
}
else{
 $('.step5 .onwards').removeClass('active');
}
});
 var bool2 = true;
$('.services').click(function(){
if(!$(this).hasClass('active')){
$(this).addClass('active');
}else{
$(this).removeClass('active');
}
$('.services').each(function(){
 bool2 = false;
if($(this).hasClass('active')){
 bool2 = true;
 return false;
}
});
 if(bool2) {
 $('.step6 .onwards').addClass('active');
}
else{
 $('.step6 .onwards').removeClass('active');
}
 });


html
<div class="step step1">
infa
 <a href="javascript:void(0);" class="onwards button">Next ></a>

</div>
 <div class="step step2">
infa
 <a href="javascript:void(0);" class="onwards button">Next ></a>

</div>
July 4th 19 at 23:45
1 answer
July 4th 19 at 23:47
Solution
In the beginning of a block to put the anchor?
Yes, the idea was to put the anchor, but how to make so that after switching on the trail of a unit page has moved to this anchor? - Estel_Kulas79 commented on July 4th 19 at 23:50
window.location.hash = '#anchor'; - Reagan_Bins68 commented on July 4th 19 at 23:53
: thank you. made a condition by clicking - Estel_Kulas79 commented on July 4th 19 at 23:56

Find more questions by tags JavaScript