IScroll自动计算高度代码

白昼怎懂夜的黑 提交于 2019-12-07 11:37:40
setScrollHeight: function () {
        var temp_height = 0;
        temp_height = $("#" + this.wrapperId).height();
        try {
            var showHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - this.headAndBottomHeight;
            if (temp_height !== showHeight)
                temp_height = showHeight;
        }
        catch (e) { ; };
        $("#" + this.wrapperId).height(temp_height);
        if (!this.isNoData)//有数据
        {
            $("#" + this.scrollId).css("min-height", temp_height + 1);
            $("#" + this.scrollId).height("");
            $("#" + this.scrollId).height($("#" + this.scrollId).height()+20);
        } else {//无数据
            $("#" + this.scrollId).css("min-height", 0);
            $("#" + this.scrollId).height("");
        }
        if (this.myScroll === undefined || this.myScroll === null) this.loadedsroll();
        else this.myScroll.refresh();
    }

核心为红色部分,最后一句加20

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!