[英]Anchor #Tag moves entire page up when div clicked
I am facing a problem with #tag
.我正面临
#tag
的问题。 I have 6 div
on the page.我在页面上有 6 个
div
。 Each div
has some 9 div
which have hidden content and displayed when their related thumbnails are clicked.The problem is that entire page moves up when thumbnail of the 3 - 4 or 5 - 6 div
are clicked.每个
div
有大约 9 个div
,它们具有隐藏的内容,并在单击其相关缩略图时显示。问题是单击 3 - 4 或 5 - 6 div
缩略图时整个页面向上移动。 I have div
in below order我有以下顺序的
div
<br> 1 2 <br>
3 4<br>
5 6<br>
Please can somebody answer what may be the issue.请有人回答可能是什么问题。
#tage
is you used for to single page link. #tage
用于单页链接。 So if there is no id found in your page then it will jump to body tag so use javascript instead of using # like bellow.因此,如果您的页面中没有找到 id,那么它将跳转到 body 标记,因此请使用 javascript 而不是使用 # 像波纹管。
<a href="javascript:void(0);" ></>
If you are using click event on anchor tag, give href
as href="#"
.如果您在锚标记上使用 click 事件,请将
href
为href="#"
。 If you don't mention href
, page will scrolled to top on click.如果您不提及
href
,页面将在点击时滚动到顶部。
试试吧 它不会将您的页面滚动到顶部。
href="javascript:void(0)" onclick="yourFunction();"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.