How to use the viewport.getScrollTop 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-wkfun-newslist / mip-wkfun-newslist.js View on Github external
viewport.on('scroll', function () {
            var scrollTop =  viewport.getScrollTop();
            if (scrollTop < sHeight) {
                $('.item-hd-so-box').css('margin-top', -scrollTop);
            }
            else if (scrollTop === 0) {
                $('.item-hd-so-box').css('margin-top', 0);
            }
            else {
                $('.item-hd-so-box').css('margin-top', -sHeight);
            }
        });
        // 展开全文
github mipengine / mip-extensions-platform / mip-jia-redpacket / mip-jia-redpacket.js View on Github external
viewport.on('scroll', function () {
            // 滚动条滚动的距离
            var scrollTop = viewport.getScrollTop();
            // 内容高度
            var domHeight = viewport.getScrollHeight();
            // 视口高度
            var viewHei = viewport.getHeight();
            if ($(ele.scrollClass).length > 0) {
                var eleTop = $(ele.scrollClass).offset().top;
                if (location.host === 'm.jia.com' || util.platform.isAndroid()) {
                    if (scrollTop > 10 && eleTop > scrollTop + viewHei / 2) {
                        $(ele.class).parent().addClass('hide');
                    }
                    else {
                        $(ele.class).parent().removeClass('hide');
                    }

                    if (eleTop <= scrollTop + viewHei / 2) {
                        $(ele.class).parent().addClass('shake');
github mipengine / mip-extensions-platform / mip-jm-select / mip-jm-select.js View on Github external
$el.find('.fixed_cirle1').click(function () {
            console.log(viewport.getScrollTop());
            $el.find('.fixedshow').addClass('fixedshowbug');
            $el.find('.dialog_relaxed').show();
            $el.find('.relaxed_content').css('top', viewport.getScrollTop() + 300 + 'px');
            $el.find('.dialog_relaxed').css('height', viewport.getScrollTop() + 1000 + 'px');
            stop();
            $el.find('.relaxed_content').bind('touchmove', function (e) {
                e.preventDefault();
            });
            $el.find('.dialog_relaxed').bind('touchmove', function (e) {
                e.preventDefault();
            });
        });
        $el.find('.delete').click(function () {
github mipengine / mip-extensions-platform / mip-fh-dropload / mip-fh-dropload.js View on Github external
viewport.on('scroll', function (e) {
                if (viewport.getScrollTop() + viewport.getHeight() >= viewport.getScrollHeight() - 20) {
                    if (ajaxs.nowPage === ajaxs.totalPage) {
                        return;
                    }
                    else {
                        dropload(element, params);
                    }
                }

            });
        }
github mipengine / mip-extensions-platform / mip-jia-infinite / mip-jia-infinite.js View on Github external
viewport.on('scroll', function () {
                    if (viewport.getHeight() + viewport.getScrollTop() >= viewport.getScrollHeight() - dis) {
                        that.control();
                    }
                });
            }
github mipengine / mip-extensions-platform / mip-lscyb-list / mip-lscyb-list.js View on Github external
viewport.on('scroll', function (e) {
                if (viewport.getScrollTop() + viewport.getHeight() >= viewport.getScrollHeight()) {
                    if (ajaxs.nowPage === params.count || ajaxs.nowPage >=  params.count) {
                        $(element).find('.dropload-down').html(endhtml);
                        return;
                    }
                    else {
                        dropload(element, params);
                    }
                }

            });
        }
github mipengine / mip-extensions-platform / mip-jia-loadscroll / mip-jia-loadscroll.js View on Github external
viewport.on('scroll', function () {
                    if (viewport.getHeight() + viewport.getScrollTop() >= viewport.getScrollHeight() - dis) {
                        that.$parentBox.is(':visible') && that.control();
                    }
                });
            }
github mipengine / mip-extensions-platform / mip-wkfun-newclub / mip-wkfun-newclub.js View on Github external
viewport.on('scroll', function () {
            var scrollTop =  viewport.getScrollTop();
            if (scrollTop < sHeight) {
                $('.chat-top').css('margin-top', -scrollTop);
            } else if (scrollTop === 0) {
                $('.chat-top').css('margin-top', 0);
            } else {
                $('.chat-top').css('margin-top', -sHeight);
            }
        });
github mipengine / mip-extensions-platform / mip-wkfun-change-style / mip-wkfun-change-style.js View on Github external
viewport.on('scroll', function () {
            var scrollTop =  viewport.getScrollTop();
            if (scrollTop < sHeight) {
                $('.chat-top').css('margin-top', -scrollTop);
            } else if (scrollTop === 0) {
                $('.chat-top').css('margin-top', 0);
            } else {
                $('.chat-top').css('margin-top', -sHeight);
            }
        });
github mipengine / mip-extensions-platform / mip-zmall-tab-anchor / mip-zmall-tab-anchor.js View on Github external
viewport.on('scroll', function () {
            var st = viewport.getScrollTop();
            tabPanelIds.forEach(function (item, index) {
                var tabPanelElement = document.querySelector(item);
                var top = tabPanelElement.offsetTop - elementHeight;
                var bottom = tabPanelElement.offsetHeight + top;
                if (st > top && st < bottom) {
                    var anchorElement = tabAnchorItems[index];
                    var activeAnchor = anchorElement.parentNode.querySelector('.' + activeClassName);
                    activeAnchor && activeAnchor.classList.remove(activeClassName);
                    anchorElement.classList.add(activeClassName);
                }
            });
        });

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