关于javascript:js设置用户必须阅读完全文才可以勾选同意协议

38次阅读

共计 330 个字符,预计需要花费 1 分钟才能阅读完成。

获取到以后元素,而后获取以后元素的高度、滚动条间隔顶部高度,滚条高度,从而进行判断。
代码如下:

that.$nextTick(() => {const el = document.querySelector('.reg-pro-wrap');
    const offsetHeight = el.offsetHeight;
    el.onscroll = () => {
        const scrollTop = el.scrollTop;
        const scrollHeight = el.scrollHeight;
        if ((offsetHeight + scrollTop) - scrollHeight >= -1) {
            // 须要执行的代码
            console.log('已滚动到底部')
            that.disabled = false;
        }
    };
});

正文完
 0