【发布时间】:2016-12-02 07:06:32
【问题描述】:
我正在尝试在 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,我现在发布了 :)
标签: javascript jquery scroll smooth-scrolling