• 触底下拉


        $(window).scroll(function(){
    var flag=true;
    var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
    var scrollHeight = $(document).height(); //当前页面的总高度
    var clientHeight = $(this).height(); //当前可视的页面高度
    // console.log("top:"+scrollTop+",doc:"+scrollHeight+",client:"+clientHeight);
    if(scrollTop + clientHeight+1 >= scrollHeight){ //距离顶部+当前高度 >=文档总高度 即代表滑动到底部
    //滚动条到达底部

    text = $(this).text();
    shou = $("#shou").val();
    wei = $("#wei").val();
    page=parseInt(shou)+1>wei?wei:parseInt(shou)+1
    if(flag){
    flag=false;
    console.log(flag);
    $.ajax({
    url: "/home/index/goodslistpage",
    type: "post",
    data: {
    page: wei
    },
    success: function (data) {

    var flag=true;
    var str = ''
    $.each(data,function (k,v) {

    if(v.name!== undefined) {
    var val=$("#a"+v.id).val();
    console.log("#a"+v.id);
    console.log(val);
    if (val == undefined){
    console.log(1);
    str+="<div class='content-item'>"
    str+="<input type='hidden' id='a"+ v.id+"' value='1'>"
    str+= " <a href='#' onclick='showDetail(this)' id='"+v.id+"'>"
    str+= " <img src='" + v.cover + "' class="slide-image"/>"
    str+= " </a>"
    str+= " <div class='content-item-title'>"
    str+= " <text style="color:#353535;">"+v.name+"</text>"
    str+= " <text style="font-size:20rpx; color:#a9a9a9;">"+v.brand_name+"· "+v.c_sname+"</text>"
    str+= " </div>"
    str+= " </div>"
    }else{
    return false;
    flag=false;
    }

    }


    })
    if(flag){
    $('#wei').val(data.page);
    $(".cover").append(str)
    }

    }
    })

    }
  • 相关阅读:
    添加yum源
    tar命令
    tomcat压力测试、优化
    vi命令
    Linux简单命令
    Linux简单命令
    vi命令
    tomcat压力测试、优化
    tar命令
    动态加载 CSS 文件
  • 原文地址:https://www.cnblogs.com/maohongli/p/12841385.html
Copyright © 2020-2023  润新知