简体   繁体   English

jQuery自定义滚动导致闪烁

[英]jQuery custom scroll causes flicker

I'm using this jQuery custom content scroller and it causes the scrollable section to flicker. 我正在使用此jQuery自定义内容滚动条 ,它会导致可滚动部分闪烁。

  • On clicking another random button it continuously flickers 单击另一个随机按钮时,它会连续闪烁
  • If I take no action, it flickers on every few seconds interval 如果我不采取任何措施,则每隔几秒钟闪烁一次

The code used: 使用的代码:

$('.custom-scrollbar').mCustomScrollbar({
  scrollInertia: 0,
  alwaysShowScrollbar: 1, // adding / removing this causes no difference
  scrollbarPosition: 'outside'
});

Attached a gif to demonstrate the issue: http://gyazo.com/9ea9d558f2630c74a157c70a367d1868 附加了gif来演示此问题: http : //gyazo.com/9ea9d558f2630c74a157c70a367d1868

If it helps anyone: As a fix, I just added a 1px padding for the container; 如果它可以帮助任何人:作为修复,我为容器添加了1px的填充; no more flickering. 不再闪烁。

This custom scrollbar flicks when its container has padding. 当其容器具有填充时,此自定义滚动条会滑动。 Remove any padding from this container in css. 从CSS中的此容器中删除所有填充。 Fox ex. 福克斯前

.mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden
{
  padding: 0px;
}

I could not find a CSS solution that worked in my specific case but disabling the updateOnContentResize advanced setting did the trick (of course, at the price of disabling the corresponding feature): 我找不到适用于我的特定情况的CSS解决方案,但是禁用updateOnContentResize高级设置可以解决问题(当然,以禁用相应功能为代价):

$(".content").mCustomScrollbar({
    advanced: {
        updateOnContentResize: false
    }
});

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

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