这是我在<li class="drop-down"><a href="#"></a></li>
然后我在页面中的位置在底部,然后当我单击它时 -> drop-向下 <- 然后我的页面在顶部,我该如何解决这个问题,我的导航栏是固定位置。
It is the normal behaviour of any browser, that it will navigate to the top of your page if you click on an anchor that's href ttirbute is a hash "#". If you want to prevent this behaviour, please leve the hash away, or prevent it by using Javascript.
href="#"
casuses that issue for you. Try linking it to an actual item in your page. Or what you could do:
href="#!"
or a third option:
href="#" class="stop"
with jQuery
$('.stop').click(function(e) {
e.preventDefault();
});
You can use the following without JavaScript
<a href="javascript:;>My link</a>
Or
<a href="javascript:void(0);">My link</a>
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.