简体   繁体   中英

Anchor #Tag moves entire page up when div clicked

I am facing a problem with #tag . I have 6 div on the page. 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. I have div in below order

<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. 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.

<a href="javascript:void(0);" ></>

If you are using click event on anchor tag, give href as href="#" . If you don't mention href , page will scrolled to top on click.

试试吧 它不会将您的页面滚动到顶部。

href="javascript:void(0)" onclick="yourFunction();"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM