Barba.js 触发锚链接上的转换
这里是 Barba.js 的菜鸟用户。
我在 Joomla 网站上使用 Barba.js,几乎一切都工作正常。
我的问题是 Barba.js 还在我的锚链接上触发页面转换,并且它重定向到主页。
<a href="#section3">Click here</a>
这是我的 mydomain.com/index.php/secondPage 上的元素
当我单击该元素时,网站 barba-transitions 到 mydomain.com/index.php#section3
但是如果我转到我的第二页并刷新页面,锚链接就可以正常工作。
我缺少什么?
非常感谢。
quite noob user of Barba.js here.
I am using Barba.js on a Joomla website, and almost everything is working fine.
My problem is that Barba.js is triggering the page transition also on my anchor links, and it redirects to the homepage.
<a href="#section3">Click here</a>
This is the element that I have on my mydomain.com/index.php/secondPage
When I click on the element, the site barba-transitions to mydomain.com/index.php#section3
But if I go to my secondPage and refresh the page, the anchor link works perfectly.
What am I missing?
Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不希望 Barba.js 处理某些链接,您可以向它们添加一个类 - 这样 Barba 就知道这不是 Barba 的事。
例如 - 添加 Prevent-barba 类,然后在 Barba init 函数参数中添加:
希望有帮助:)
If you don't want certain links to be processed by Barba.js you can add a class to them - so the Barba knows it's not Barba business.
For example - add prevent-barba class and then in Barba init function parameters add:
Hope that helps :)