我想在location.hash中放一個平滑的滾動條,但它似乎不工作。如何使用location.hash平滑滾動?
如何解決這個問題?
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>
你也可以發佈你的'html'嗎? –
@GuruprasadRao,我現在發佈:) – User014019