iScroll不滚动内容,只是反弹回顶部

Mik*_*679 7 iscroll

我已经阅读了很多论坛,但没有一个能解决我的问题.我确定它有点小我不见了

这是iscroll初始化:

// make PI scroll
piScroll2 = new iScroll('pi_scroll2');
Run Code Online (Sandbox Code Playgroud)

这是我的css:

.pi_panel.large .content{
position: absolute;
width: 963px;
height: 616px;
top: 65px;
left:30px;
background:none;
/*background:url(../images/ISI_body.png) repeat-y;*/
overflow:scroll;
    -webkit-border-radius: 0px;
Run Code Online (Sandbox Code Playgroud)

}

#FullPiWrapper
{
   position:relative; 
   z-index: 1; 
   overflow:hidden; 
   top: 60px; 
   width:980px;
   height: 610px;
}

.pi_panel .pi_box{
padding: 0px;
margin: 20px 0px;
Run Code Online (Sandbox Code Playgroud)

}

这是我的HTML:

<!-- BEGIN:   PI PANEL LARGE -->
    <div class="pi_panel large">
     <div class="topBarPiFull">
                <div class="title">Full Prescribing Information</div>
                <div class="close_button_fullpi">Close</div>
                <div class="annotated_pi_button">Annotated PI</div>
            </div>
<!--            <div class="popContent"></div>-->
          <div class="content" id="FullPiWrapper">

                <div id="pi_scroll2">


                    <div class="pi_box" >
                        <img src="_globals/images/PI/pi_1.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_2.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_3.png"/>
                        <img src="_globals/images/PI/pagebreak.png"/>
                        <img src="_globals/images/PI/pi_4.png"/>
                        <img src="_globals/images/PI/pagebreak.png"/>
                        <img src="_globals/images/PI/pi_5.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_6.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_7.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_8.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_9.png"/>
                        <img src="_globals/images/PI/pagebreak.png" />
                        <img src="_globals/images/PI/pi_10.png"/>
                    </div>
                 </div>

            </div>
     </div>
    <!-- END:   PI PANEL LARGE -->
Run Code Online (Sandbox Code Playgroud)

Mik*_*679 10

问题是,当页面首次加载时,您不能将任何父级的div类显示设置为"none".所以我设置'pi_panel large'来显示:'block';

  • 加1来自我.要添加到您的答案,iscroll的容器元素必须在初始化iscroll之前可见.我只是在ipad webapp上与iscroll战斗,其中所有视图都是动态显示的. (2认同)

小智 5

确保容器的高度超过包装纸的高度,即不要制作height:100%.例如,如果包装器包含容器,并且容器中有10个div:

如果每个div为100px,则包装器可能为150px.那么容器必须是1000px(不是100%!)