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

    //一次加载12个,修改版
    function jiazai(){
    var n=12; $(window).scroll( function(){ var scrollTop = 0; var clientHeight = 0; var scrollHeight = 0; var replaceAppNo=$("input[name='replaceAppNo']" ).val(); if (document.documentElement && document.documentElement.scrollTop) { scrollTop = document.documentElement.scrollTop; } else if (document.body) { scrollTop = document.body.scrollTop; } if (document.body.clientHeight && document.documentElement.clientHeight) { clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight; } else { clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight; } scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); if (scrollTop + clientHeight == scrollHeight) { n=12+n; var obj = {Num:n,Province:sousuozhi_dizhi11.province,Uid:Uid,Client_Id:Client_Id}; Get_request(140101, obj, 'post', 1);//获取热门车型 } }); }
    //原版
    $( function(){
    var i=1; $(window).scroll( function(){ var scrollTop = 0; var clientHeight = 0; var scrollHeight = 0; var replaceAppNo=$("input[name='replaceAppNo']" ).val(); if (document.documentElement && document.documentElement.scrollTop) { scrollTop = document.documentElement.scrollTop; } else if (document.body) { scrollTop = document.body.scrollTop; } if (document.body.clientHeight && document.documentElement.clientHeight) { clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight; } else { clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight; } scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); if (scrollTop + clientHeight == scrollHeight) { $.getJSON("*****Action_getAjaxList.action" ,{page:i,replace_App_No:replaceAppNo},function(json){ $.each(json, function(n,value){ var trs = "" ; trs += "<tr><td align='center'><input type='checkbox'></td><td align='center'>"+(value.quaNo== undefined?'' :value.quaNo)+"</td><td align='center'>"+(value.chaVin== undefined?'' :value.chaVin)+"</td><td align='center'>"+(value.prdModelNo== undefined?'' :value.prdModelNo)+"</td><td width='10%' align='right'>"+value.quaMone+ "</td><td align='center'>"+(value.facDate== undefined?'' :value.facDate)+"</td><td align='center'>"+(value.accDate== undefined?'' :value.accDate)+"</td><td width='6%' align='center'>"+(value.cerType== undefined?'' :value.cerType)+"</td><td align='center'>"+(value.brandNo== undefined?'' :value.brandNo)+"</td></tr>"; $( "#tablist tr:last" ).after(trs); }); }); i++; } }); });
  • 相关阅读:
    软件自动化测试工程师面试题集锦(1)
    IDEA Maven无法引入org.openjfx:javafx.base:11.0.0-SNAPSHOP
    Maven的dependency和dependencyManagement的区别
    在idea中创建多模块的SpringBoot项目
    MAVEN中三种packaging方式
    IntelliJ IDEA创建maven多模块项目
    Spring Boot 中使用 thrift 入门
    在IntelliJ IDEA使用.gitignore插件的方法和作用
    Git
    TortoiseGit安装、配置
  • 原文地址:https://www.cnblogs.com/yongwang/p/7478341.html
Copyright © 2011-2022 走看看