zoukankan      html  css  js  c++  java
  • 上拉加载 angular

    var obj = {page:1};//默认获取商品列表时传入参数,为第一页

    var flag = true;

     

    function order_list(options){

      var requestParams = {

      userId:sessionStorage.getItem("userId"),

      rowSize : 10,

      page : options.page,

    };

      var params = {

      url: configHttp+'order/list.do',

      method: 1,

      requestParams: requestParams,

      isShowLoading: false

    };

    sx.startRequest({

      params: params,

      success: function(res) {

      if(res && res.result_code == 1) {

      $scope.instances= res.object.instances;

      if($scope.instances.length == 0){

        $(".loading").html("暂无更多结果");

      }else if($scope.instances.length <10){

        $(".loading").html("暂无更多结果");

        for(var i in $scope.instances){

        $scope.data.push($scope.instances[i]);

      };

      }else{

        for(var i in $scope.instances){

        $scope.data.push($scope.instances[i]);

      };

      obj.page = obj.page+1;

      flag = true;

      $(".loading").html("加载更多");

    }

      $scope.$apply();

    }else{

      sixin.toast({message: "商品获取失败", type:"0"});

    };

    }

    })

    }

     

     

    //控制回到顶部按钮的显隐及加载更多

    $(window).on("scroll",function(){

      var windowBottom =$(window).scrollTop();

      var eleBottom = $(".orderList").offset().top+$(".orderList").height();

      remaining = windowBottom + $(window).height() + 50 - eleBottom;

      var shouldScroll = remaining>0?true:false;

      if(shouldScroll && flag){

        flag = false;

        order_list(obj);

      };

    });

  • 相关阅读:
    ORACLE SQL性能优化系列 (十一)
    ORACLE SQL性能优化系列 (七)
    ORACLE SQL性能优化系列 (十三)
    Oracle绑定变量
    ORACLE SQL性能优化系列 (九)
    C#中&与&&的区别
    简单代码生成器原理剖析
    C#线程系列讲座(1):BeginInvoke和EndInvoke方法
    ClearCanvas DICOM 开发系列 一
    C# winform 获取当前路径
  • 原文地址:https://www.cnblogs.com/zyzhao/p/6041612.html
Copyright © 2011-2022 走看看