iscroll refresh無效解決辦法

iscroll refresh無效解決辦法

最近用iscroll.js 寫移動頁面,效果仍是挺好的。但,仍是會遇到從新初始化的問題。html

var myScroll = new IScroll('#rule_wrapper',{
  click:true
});app

myScroll.refresh();spa

吐槽一下,沒用沒用啊~htm

好吧,查看了些帖子,最後的解決辦法,增長定時,爲啥呢?Js是有任務棧的。blog

方法1:使用myScroll.refresh();get

setTimeout(function(){
  myScroll.refresh();
},1500)io

方法2:使用 checkDOMChanges: truefunction

$scope.loaded = function () {
    $timeout(function () {
        $scope.schoolId = new IScroll('#schoolId', {
            scrollX: false,
            scrollY: true,
            mouseWheel: true,
            checkDOMChanges: true
        });
        $scope.courseId = new IScroll('#courseId', {
            scrollX: false,
            scrollY: true,
            mouseWheel: true,
            checkDOMChanges: true
        });
        $scope.gradeId = new IScroll('#gradeId', {
            scrollX: false,
            scrollY: true,
            mouseWheel: true,
            checkDOMChanges: true
        });
    },1500)
}
相關文章
相關標籤/搜索