• iscroll实例化iscroll动态创建不能滑动



    iscroll实例化iscroll动态创建不能滑动
     
     
    newIScroll(".main")
     
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
            <script src="zepto.js" type="text/javascript" charset="utf-8"></script>
            <script src="iscroll.js" type="text/javascript" charset="utf-8"></script>
            <style type="text/css">
                *{
                    margin:0;
                    padding:0;
                }
                html,body,#box{
                    height:100%;
                    100%;
                }
                #box{
                    display: flex;
                    flex-direction: column;
                }
                header{
                    height:50px;
                    100%;
                    line-height:50px;
                    text-align:center;
                    background:pink;
                    color:#007AFF;
                }
                footer{
                    height:50px;
                    100%;
                    line-height:50px;
                    text-align:center;
                    background:#ccc;
                    color:red;
                }
                #main{
                    flex:1;
                    overflow: hidden;
                }
            </style>
        </head>
        <body>
            <div id="box">
                <header>头部</header>
                <div id="main">
                    <div>
                    </div>
                </div>
                <footer>尾部</footer>
            </div>
            <script type="text/javascript">
            ajax()
            function ajax(){
                $.ajax({
                    url:"http://datainfo.duapp.com/shopdata/getGoods.php",
                    dataType:"jsonp",
                    success:function(data){
                        $.each(data,function(index){
                            var dl=$("<dl></dl>")
                            var dt=$("<dt></dt>")
                            var dd=$("<dd>"+data[index].goodsName+"</dd>")
                            var img=$("<img src='"+data[index].goodsListImg+"'/>")
                            dl.append(dt)
                            dl.append(dd)
                            img.on("load",function(){
                                dt.append(img)
                                myScroll.refresh()
                            })
                            $(".list").append(dl)
                        })
                    }
                });
            }
     
     
     
                        var myScroll = new IScroll("#main")
            $(".list").on("touchend",function(){
                //console.log(myScroll.y)
                if(myScroll.y>50){
                    console.log("正在刷新")
                }else if(myScroll.y<myScroll.maxScrollY-50){
                    ajax()
                }
            })
     
     
     
            </script>
        </body>
    </html>
  • 相关阅读:
    hadoop 配置
    spark 学习网站和资料
    spark-submit 提交任务及参数说明
    python 浮点运算
    nginx 和 php
    clojure 语法
    编程语言
    spark
    mvn 与 pom.xml
    偏导数与偏微分
  • 原文地址:https://www.cnblogs.com/zhangshuda/p/7640326.html
Copyright © 2020-2023  润新知