推荐几款vue滚动scroll插件

2020-12-01 16:49:13

浏览器滚动效果,重写滚动条,我们可以选择第三方插件。iScroll 或者 better-scroll

iScroll better-scroll 他们各有千秋,大家看着办吧。



监听滚动,做效果,我推荐  vue-scroll  ,使用这个插件,我们可以轻松的解决 

throttle

debounce

问题


throttle和debounce的区别 参考连接 throttle 和 debounce区别和用法


无论怎么找vue插件,实现div内的平滑滚动效果,还是我大 jquery,最后还是加载了jquery插件


参看地址 nuxtjs引入jquery



通过几句jquery代码实现页面平滑滚动到某一锚点的效果。实现代码来源于https://css-tricks.com/snippets/jquery/smooth-scrolling

实现的jquery代码如下:

$('a[href*="#"]:not([href="#"])').click(function() {
            if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
                var target = $(this.hash);
                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
                if (target.length) {
                    $('html, body').animate({
                        scrollTop: target.offset().top
                    }, 1000);
                    return false;
                }
            }
        });


  • 2019-04-10 17:25:21

    Joda-Time详解,最好用的java时间工具

    任何企业应用程序都需要处理时间问题。应用程序需要知道当前的时间点和下一个时间点,有时它们还必须计算这两个 时间点之间的路径。使用 JDK 完成这项任务将非常痛苦和繁琐。