One way to implement smooth scrolling to an anchor on page load is by using jQuery. Here's an example code snippet:
$(function(){
$('html, body').animate({
scrollTop: $( $('#anchor1').attr('href') ).offset().top
}, 2000);
return false;
});
I've used this technique numerous times with the onClick
event for navigation on vertical websites.
Now, I'm looking for a solution where if a specific URL like
is accessed, it will automatically scroll smoothly to thehttp://www.cooltimes.com/#scrolltoCOOLplace
#scrolltoCOOLplace
section within my site.
This would involve triggering smooth scroll based on the URL address.
Does anyone have suggestions for how to achieve this with jQuery?