I use this function to scroll to a desired container:
function scrolear(destino){
var stop = $(destino).offset().top;
var delay = 1000;
$('body').animate({scrollTop: stop+'px'}, delay);
return true;
}
The problem comes when is used like this:
<a href="#" onclick="scrolear('#container');">go</a>
Because the href="#" makes body to scroll to top of page.
Is there a way to prevent this?
This will just assign a javascript function to the href, which will do nothing at all,so no page scroll happens like with
#