滚动时删除#anchor-id [英] remove the #anchor-id when scrolling

查看:96
本文介绍了滚动时删除#anchor-id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此jQuery http://css-tricks.com/examples/SmoothPageScroll/创建平滑的页面滚动,但是,每当我单击可滚动元素时,锚ID就会出现在地址栏上.

I'm using this jquery http://css-tricks.com/examples/SmoothPageScroll/ to create a smooth page scroll, however each time I click a scrollable element, the anchor ID appears on the address bar.

有什么办法可以防止这种情况发生?

Is there any way to prevent this to happen?

非常感谢.

推荐答案

该示例将标记显式添加到url:

The example explicitly adds the tag to the url:

// Set hash in URL after animation successful
location.hash = target;

您应该可以删除/注释此行.

You should be able to remove/comment this line.

这篇关于滚动时删除#anchor-id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆