I have used pagination on one of my forms and everything is working great, but when I click the "next" button it takes me to the bottom of the next page. I am trying to figure out code to add so it will take me to the top of the next page instead of the bottom, but I cant seem to get it working. Does anyone know what script and where, I could add to achieve this?
Question
Question
Navigating "Next" button to the top of the next page.
asked on July 21, 2016
•
Show version history
0
0
Answer
SELECTED ANSWER
replied on July 27, 2016
Place window.scrollTo(0,0); immediately after the last else if statement.
1
0
Replies
replied on July 22, 2016
Hi Jody,
Can you provide a sample of your pagination code?
0
0
replied on July 22, 2016
In the code where you handle the button press, can you just add
window.scrollTo(0,0);
0
0
replied on July 27, 2016
$(document).ready(function () {
//pagination
$('.navitem').on('touchstart click', function () {
$('.sections,.Submit').hide();
$('.navbar').find('.navitem').removeClass('selected');
if ($(this).hasClass('Applicant')) {
$('.section1').show();
$('.navbar').find('.Applicant').addClass('selected');
}
else if ($(this).hasClass('PersonalInfo')) {
$('.section2').show();
$('.navbar').find('.PersonalInfo').addClass('selected');
}
else if ($(this).hasClass('PreviousEducation')) {
$('.section3').show();
$('.navbar').find('.PreviousEducation').addClass('selected');
}
else if ($(this).hasClass('FinancialAid')) {
$(".section4, .Submit").show();
$('.navbar').find('.FinancialAid').addClass('selected');
}
else if ($(this).hasClass('Checklist')) {
$(".section5, .Submit").show();
$('.navbar').find('.Checklist').addClass('selected');
}
else if ($(this).hasClass('Declaration')) {
$(".section6, .Submit").show();
$('.navbar').find('.Declaration').addClass('selected');
}
})
$('.navitem.Applicant').trigger('click');
//end pagination
$("#q126 label").css('font-weight', 'bold') .css('font-size', '15px');
$("#q128 label").css('font-weight', 'bold') .css('font-size', '15px');
$("#q129 label").css('font-weight', 'bold') .css('font-size', '15px');
$("#q130 label").css('font-weight', 'bold') .css('font-size', '15px');
$("#q131 label").css('font-weight', 'bold') .css('font-size', '15px');
$("#q103 label").css('font-size', '15px');
$("#q105 label").css('font-size', '15px');
});
I believe it will work, I had been trying to use that but I'm unsure of where to put it in this code....
0
0
SELECTED ANSWER
replied on July 27, 2016
Place window.scrollTo(0,0); immediately after the last else if statement.
1
0
replied on July 27, 2016
That worked great. Thank you so much!
0
0
You are not allowed to follow up in this post.