I'm using the following code to link to a section on a page.
$('a[href^="#"]').on('click', function (event) {
var target = $(this.href);
if (target.length) {
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
}
});
<a href="#group1" class="save">Save 20%</a>
The link is positioned absolute on the bottom right of the screen;
Is there a way I can change the link on click? So that When you Click <a href="#group1"
It scrolls to that section and then the same link becomes #group2,
and then becomes #group3