I have a div whose id is 'regOrg' and initially it is hidden using a css
display: none;
The link to be clicked has an id of back
.
On clicking a link I want it to show and smooth scroll down to it (the div regOrg
).
This is the code i have:
function goBack() {
$("#regOrg").show();
$("#back").click(function() {
$('html, body').animate({
scrollBottom: $("#regOrg").offset().bottom
}, 2000);
});
}
I call the function goback()
on the onclick
event of the hyperlink.
However it doesn't work. It only shows the div but doesn't scroll to it.