简体   繁体   English

滚动导航滞后

[英]Sticky navigation lag on scroll

This is the site I am working on: Click here - Home Page Scroll Issue . 这是我正在工作的网站: 单击此处-主页滚动问题

I am using Foundation 5, a sticky scrollbar and Owl Carousel (I have tried using Slick carousel and the result is the same). 我正在使用Foundation 5,粘性滚动条和Owl Carousel(我尝试使用Slick旋转木马,结果是相同的)。

The issue I'm experiencing is that whenever I scroll up/down and the top bar goes over the carousel, the whole page stutters and the scroll bumps and stops shorter than its expected trajectory. 我遇到的问题是,每当我向上/向下滚动并且顶部栏越过转盘时,整个页面就会出现断断续续,滚动颠簸且停止的时间短于其预期轨迹的情况。

I have tried a lot of solutions including applying z-index and -webkit-transform: translateZ(0) rules to the carousel with no success. 我已经尝试了很多解决方案,包括将z-index-webkit-transform: translateZ(0)应用于-webkit-transform: translateZ(0)转盘上的-webkit-transform: translateZ(0)规则均未成功。

This problem doesn't seem to exist in Firefox or Edge or at least is not as obvious. 这个问题似乎在Firefox或Edge中不存在,或者至少不那么明显。

Any ideas? 有任何想法吗?

**Update, Ajay Varghese's answer seems to help for the down scroll, but the issue still exists when scrolling up. **更新, Ajay Varghese的答案似乎有助于向下滚动,但是向上滚动时问题仍然存在。 When duplicating the next content row to increase the length of the page, if you try to scroll up to reveal the carousel it jumps and creates a scroll stutter. 当复制下一个内容行以增加页面的长度时,如果尝试向上滚动以显示轮播,则它会跳跃并创建滚动条。 This issue is very annoying and I still can't seem to find the cause. 这个问题很烦人,我似乎仍然找不到原因。

try by adding overflow: hidden; 尝试添加overflow: hidden; in .fixed class 在.fixed类中

.fixed {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 99;
    overflow: hidden;
    left: 0;
}

I didn't understand exactly how the issue is happening. 我不完全了解问题是如何发生的。 But I tried something and got the issue solved. 但是我尝试了一下,问题就解决了。 Jumping is not happening after I removed the 'margin-top' that you have given for .main-content.That will keep the carousel stick to the .main-content box which we don't want. 在删除您为.main-content指定的'margin-top'之后,不会发生跳转。这将使轮播固定在我们不需要的.main-content框上。 I solved it by giving some extra height and pushed carousel down by giving 'position:relative' and 'top:15px'. 我通过提供一些额外的高度来解决该问题,并通过提供“ position:relative”和“ top:15px”将轮播向下推。 Can you try this and let me know ? 你可以试试看,让我知道吗?

This issue only exists in Chrome. 此问题仅在Chrome中存在。 The issue seems to be that WebKit does not handle layering very well sometimes. 问题似乎是WebKit有时无法很好地处理分层。

Here is the solution that worked perfectly for me: body { -webkit-transform: translate3d(0, 0, 0);} 这是最适合我的解决方案: body { -webkit-transform: translate3d(0, 0, 0);}

Hope this helps someone and saves their precious time. 希望这可以帮助某人并节省他们的宝贵时间。

**UPDATE, I didn't realise that this breaks the sticky topbar. **更新,我没有意识到这会破坏粘性的顶栏。 Therefore, this solution is not feasible. 因此,该解决方案是不可行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM