Web/!/auto-generate/js/plugin/pull.js

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

uap({
    pulls: function (opt) {
        var startHeight = 36, lineHeight = 30;
        opt = $.extend(true, {
            up: {
                height: startHeight
                , pulling: '<div style="color:#AAA;line-height:' + lineHeight + 'px;">你再拉试试</div>'
                , ready: '<div style="color:#888;line-height:' + lineHeight + 'px;">放开我加载更多</div>'
                , callback: function (obj) {
                    obj.stop().html('loading').animate({ height: lineHeight }, function () {
                        uap.alert('option.up.callback not set', function () {
                            obj.height(0);
                        });
                    });
                }
            }
            , down: {
                height: startHeight
                , pulling: '<div style="position:absolute;width:100%;bottom:0;text-align:center;line-height:' + lineHeight + 'px;color:#AAA">再拉试试</div>'
                , ready: '<div style="position:absolute;width:100%;bottom:0;text-align:center;line-height:' + lineHeight + 'px;color:#888">加载更多</div>'
                , callback: function (obj) {
                    obj.stop().html('<div style="line-height:' + lineHeight + 'px;">loading</div>').animate({ height: lineHeight }, function () {
                        uap.alert('option.down.callback not set', function () {
                            obj.height(0);
                        });
                    });
                }
            }
        }, opt);
        var y, h, t, v, vh, body = document.body, ev, d = $(document);
        var down = $('<div style="text-align:center;overflow:hidden;height:0;position:relative"></div>').insertBefore(body.firstChild);
        var uper = $('<div style="text-align:center;overflow:hidden;height:0;position:relative"></div>').appendTo(body);
        uper.close = down.close = function (callback) {
            this.stop().animate({ height: 0 }, 345, callback);
        };
        d.on('touchstart', function (e) {
            ev = '';
            y = e.originalEvent.touches[0].clientY;
            vh = document.compatMode == 'CSS1Compat' ? document.documentElement.clientHeight : body.clientHeight;
            h = body.offsetHeight - vh;
            t = body.scrollTop;
        }).on('touchend', function (e) {
            if (!ev) return;
            switch (ev) {
                case 'up':
                    uper.close();
                    v > opt.up.height && opt.up.callback && opt.up.callback(uper);
                    break;
                case 'down':
                    down.close();
                    v > opt.down.height && opt.down.callback && opt.down.callback(down);
                    break;
            }
        });
        if (opt.up) {
            d.on('touchmove', function (e) {
                var Y = y - e.originalEvent.touches[0].clientY;
                if (h <= body.scrollTop & Y > 0) {//滚动条底部
                    if (ev == '') {
                        y = e.originalEvent.touches[0].clientY;
后面还有 39 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。