chjtx / JRoll

Smooth scrolling for the mobile web
http://www.chjtx.com/JRoll/
MIT License
460 stars 91 forks source link

ios11 最新版本 取history.state里面的去加载页面会无限加载页面 #64

Closed archorfight closed 6 years ago

archorfight commented 6 years ago

请问作者可以提供一下 解决办法或者 解决思路吗?

archorfight commented 6 years ago

/**

resumeAll = function(jroll){ var state = history.state; if (state != null){ if (state.htmlSelectors != null){ for (var i = 0; i < state.htmlSelectors.length; i++){ var selector = state.htmlSelectors[i]; if ($(selector).prop("tagName") == 'INPUT'){ $(selector).val(state.html[selector]); }else{ $(selector).html(state.html[selector]); } } }

    if (state.attrSelectors != null){
        for (var i = 0; i < state.attrSelectors.length; i++){
            var selector = state.attrSelectors[i];
            $(selector).attr('style', state.attr[selector]);
        }
    }
    resumeObj(state.data, window);

    if (jroll != null){
        jroll.maxScrollY = __jrollMaxScrollY;
        __jrollSrollY = isObjNull(__jrollSrollY) ? 0 : __jrollSrollY;
        jroll.options.page = isObjNull(__jrollPage) ? 0 : __jrollPage;
        jroll.options.total = isObjNull(__jrollTotal) ? 0 : __jrollTotal;
        jroll.scrollTo(0, __jrollSrollY, 0, false);
        jroll.refresh();
    }
}

}

chjtx commented 6 years ago

:astonished: 能把格式对齐一下吗?或者在http://runjs.cn/写个demo

archorfight commented 6 years ago

http://runjs.cn/code/75pgp4zn 这个在ios11.3通过缓存加载会无限刷新 http://runjs.cn/code/cerfh831 这种方式又不会。有空看一下为啥吗?