How to use the viewport.on function in viewport

To help you get started, we’ve selected a few viewport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mipengine / mip-extensions-platform / mip-trilobite-log-new / mip-trilobite-log-new.js View on Github external
if (isFirstReadDone) {
                        var overPageDistance = (articleContent.offsetTop + articleContent.offsetHeight)
                            - viewport.getHeight();
                        if (overPageDistance < 0) {
                            // 正文内容不超过一屏
                            log.trace(['appArticleDetail', '{' + tpId + '}', '{' + contentId + '}', 'done']);
                            isFirstReadDone = false;
                        }
                        else if (scrollDistance >= overPageDistance) {
                            log.trace(['appArticleDetail', '{' + tpId + '}', '{' + contentId + '}', 'done']);
                            isFirstReadDone = false;
                        }
                    }
                }
                scrollHandle();
                viewport.on('scroll', scrollHandle);
            }

            // $('.listArticle').on('click', function () {
            //     log.trace(['cambrian', 'listArticle']);
            // });
            // $('video').on('play', function () {
            //     log.trace(['cambrian', 'detailVideo']);
            // });
            // $('[data-role="j-recommend-download"]').on('click', function () {
            //     log.trace(['cambrian', 'recommendDownload']);
            // });
        })();
    };
github mipengine / mip-extensions-platform / mip-jia-footertl / mip-jia-footertl.js View on Github external
windowScroll: function (data, ele) {
                storage.rm('usFlag');
                // 滚动事件
                viewport.on('scroll', function () {
                    if (storage.get('usFlag') === 'true') {
                        return false;
                    }
                    zxbjPage.method.scrollFun(data, ele);
                });
            },
            changeHtml: function (obj, ele) {
github mipengine / mip-extensions-platform / mip-jia-footertlplus / mip-jia-footertlplus.js View on Github external
windowScroll: function (data, ele) {
                storage.rm('usFlag');
                // 滚动事件
                viewport.on('scroll', function () {
                    if (storage.get('usFlag') === 'true') {
                        return false;
                    }
                    zxbjPage.method.scrollFun(data, ele);
                });
            },
            changeHtml: function (obj, ele) {
github mipengine / mip-extensions-platform / mip-jia-infinite / mip-jia-infinite.js View on Github external
bindEvent: function () {
            var that = this;
            if (that.event === 'click') {
                that.$btn && that.$btn.on('click', function () {
                    that.control();
                });
            } else {
                var dis = that.bottomDistance;
                viewport.on('scroll', function () {
                    if (viewport.getHeight() + viewport.getScrollTop() >= viewport.getScrollHeight() - dis) {
                        that.control();
                    }
                });
            }
        },
        control: function () {
github mipengine / mip-extensions-platform / mip-jia-loadscroll / mip-jia-loadscroll.js View on Github external
bindEvent: function () {
            var that = this;
            if (that.event === 'click') {
                that.$btn && that.$btn.on('click', function () {
                    that.control();
                });
            } else {
                var dis = that.bottomDistance;
                viewport.on('scroll', function () {
                    if (viewport.getHeight() + viewport.getScrollTop() >= viewport.getScrollHeight() - dis) {
                        that.$parentBox.is(':visible') && that.control();
                    }
                });
            }
        },
        control: function () {

viewport

represents the browsers viewport as a signal changing over time

MIT
Latest version published 9 years ago

Package Health Score

42 / 100
Full package analysis