禁用页面滚动" href"

时间:2017-06-04 02:14:31

标签: html href

我在" div"中显示了4个不同的表格。具有链表,即显示的表根据单击列表中的链接而变化。

当用户点击链接时,页面会自动向下滚动到" div"的顶部。我想禁用此页面移动,有没有办法做到这一点?

基本上,我希望用户能够选择他们想要查看的表格,但又不希望页面自动滚动到" div"的顶部。

<ul style="list-style-type: none; margin: 0; padding: 0; overflow: hidden;">
<li style="list-style-type: none; float: left;"><a style="color: white; font-size: 100%;" href="#MB"><strong>ONE</strong></a></li>
<li style="list-style-type: none; float: left;"><a style="color: white; font-size: 100%;" href="#DS"><strong>TWO</strong></a></li>
<li style="list-style-type: none; float: left;"><a style="color: white; font-size: 100%;" href="#AF"><strong>THREE</strong></a></li>
<li style="list-style-type: none; float: left;"><a style="color: white; font-size: 100%;" href="#DT" ><strong>FOUR</strong></a></li>

<div style="width: 100%; float: right; overflow: hidden;">
<div style="white-space: nowrap;  width: 400%;">
<div id="MB" style="vertical-align:top;display: inline-block; width: 25%;">[table id=28/]</div>
<div id="DS" style="vertical-align:top;display: inline-block; width: 25%;">[table id=29/]</div>
<div id="AF" style="vertical-align:top;display: inline-block; width: 25%;">[table id=35/]</div>
<div id="DT" style="vertical-align:top;display: inline-block; width: 25%;">[table id=36/]</div>
</div>
</div>

1 个答案:

答案 0 :(得分:0)

这里最简单的选择可能就是使用不同的CliRunner.invoke() ID。

您可以使用Javascript来禁用或覆盖浏览器的默认滚动行为。

相关问题