admin管理员组文章数量:1356421
I want to make the browser to scroll the div's id
<div id="test">
lol
</div>
So I use this code
window.location = "#test";
but my url now is like this
http://locahost/index.html#test
Is it possible to delete "#test" but go to that ?
I want to make the browser to scroll the div's id
<div id="test">
lol
</div>
So I use this code
window.location = "#test";
but my url now is like this
http://locahost/index.html#test
Is it possible to delete "#test" but go to that ?
Share Improve this question asked Jul 5, 2013 at 4:49 user1128331user1128331 7274 gold badges10 silver badges20 bronze badges 01 Answer
Reset to default 7Scroll to the element:
document.querySelector('#test').scrollIntoView();
本文标签: htmljavascript windowlocation idStack Overflow
版权声明:本文标题:html - javascript window.location id - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744064852a2584798.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论