How to animate slimScroll using jQuery

家住魔仙堡 提交于 2019-12-05 17:20:33

I was looking for the same thing but couldn't find an existing solution - so I've made a simple fork of rochal's code. You can find it here: https://github.com/edragame/jQuery-slimScroll

The only change I made was to add an animate option, like so:

$("#panel2").slimScroll({ scrollTo: fromTop, animate: true });

Let me know if that helps.

"Animate: true" does not work.

You have to cut out the "if (isJump)" part in jquery.slimscroll.js and replace it with this:

if (isJump)
      {
        delta = y;
        var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
        offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
        bar.css({ top: offsetTop + 'px' });
        me.animate(
          { scrollTop: delta + 'px' },
          1200
        );
      }
      if (!isJump){
        me.scrollTop(delta);
      }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!