[英]Prevent JavaScript page jumping
I have a Magento 2 site and when a tab or accordion link is clicked the page scrolls to top of content.我有一个 Magento 2 站点,当单击选项卡或手风琴链接时,页面滚动到内容顶部。 How can I prevent this?
我怎样才能防止这种情况?
The filter tabs on the left (desktop only) http://designacake.co.uk/bakeware左侧的过滤器选项卡(仅限台式机) http://designacake.co.uk/bakeware
The accordion at the bottom of the product section: http://designacake.co.uk/katy-sue-designs-mould-creative-cake-system-easy-fabric-puff产品部分底部的手风琴: http://designacake.co.uk/katy-sue-designs-mould-creative-cake-system-easy-fabric-puff
Thank you.谢谢你。
That DOM element likely has an onClick event which is setting the scroll height of the page.该 DOM 元素可能具有设置页面滚动高度的 onClick 事件。 See https://www.w3schools.com/jsref/met_win_scrollto.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onclick for more information.
有关详细信息,请参阅https://www.w3schools.com/jsref/met_win_scrollto.asp和https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onclick 。
You will need to read through the source code of your website and find out where the onClick event was bound and try to disable the scrolling.您需要阅读您网站的源代码并找出 onClick 事件绑定的位置并尝试禁用滚动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.