<body>
<div data-anchor="page_1"></div>
<div data-anchor="page_2"></div>
<div data-anchor="page_3"></div>
<div data-anchor="page_4"></div>
</body>
http://my.site/index
时,默认页面是page_1
,URL中没有哈希部分#page_1
。page_2
,网址为http://my.site/index#page_2
http://my.site/index
。页面仍然在page_2
,我想要的是page_1
。有没有关于创建fullpage.js
的选项,还是应该将默认URL设置为http://my.site/index#page_1
?
不幸的是,这是fullPage.js中一个众所周知的错误,到目前为止还没有解决方案。
你可以在repo的github问题论坛上阅读更多关于它的信息:https://github.com/alvarotrigo/fullPage.js/issues/950
要防止这种情况,您可以使用选项recordHistory: false
或lockAnchors: true
强制fullpage.js忽略锚点。