The script below acieves the task, but I need it to run another 20 time or so. How can I optimize the script so I don`t need to call the same script over and over again?
“a1” changes to “a2”, “a3” and so on. “#thing” needs to change also so it can scroll to another part of the page
$(document).ready(function() {
$(".a1").click(function() {
$('html,body').animate({
scrollTop: $("#thing").offset().top
}, 500);
});
Something like that can do the job i think:
EDIT – after your question edit has made, i think this will solve your problem: