I'm trying to put a smooth scroll in location.hash, but it seems it's not working.
How to fix this?
JS
function test_function(){
window.location.hash = '#divid';
jQuery(document).ready(function($){
$('html, body').animate({ scrollTop: $(test_function).target.offset().top }, 1000);
});
}
HTML
<div>
<a href="<?php echo $_POST['referrer'] ?>#divid">Find a store</a>
</div>