简体   繁体   English

带有页脚和标题的iScroll已修复

[英]iScroll with footer and header fixed

If you enter http://gizeto.se/app_yellow/index.html you can see that iScroll scrolls the entire page. 如果您输入http://gizeto.se/app_yellow/index.html,您会看到iScroll滚动整个页面。 You can see the scroller lying over both the header and the footer. 您可以看到滚动条位于页眉和页脚上。 The scroller should only scroll the content , not the header and footer included. 滚动条应仅滚动内容 ,而不是包含的页眉和页脚。

I wan't to make this work because I need the fixed footer without using position:fixed - which still doesn't work on for example Android 2.1 我不想做这项工作,因为我需要固定的页脚而不使用位置:固定 - 这仍然不适用于Android 2.1

I use iScroll 4 and my JS code is inside my data-role="content" div: 我使用iScroll 4,我的JS代码在我的data-role =“content”div中:

            $(document).ready(function() {

                var myScroll = new iScroll('content');
                $(window).bind('resize', function () {
                // I also tried setting a height on the content div, but that didn't work either. Its commented out.
                //$.mobile.activePage.children('[data-role="content"]').height('200px');

                    myScroll.refresh();

                });
            });

My data-role="page" element has the data-iscroll="enable" attribute, and my html code for the scrolling part is: 我的data-role =“page”元素有data-iscroll =“enable”属性,滚动部分的html代码是:

    <div data-iscroll="scroller" class="scroller">
        <div data-iscroll="scroller">
        <h3>Välkommen</h3>

        <div style="text-align:center;">
        <img src="images/video.png" style="width: 100%; height: 100px;" class="rounded" title="" />
        </div>
        <br />

            Ticker AB är en arkitekturbyrå som arbetar inom ett brett fält av projekt, från stadsplanering till bostäder via kontor och handel. Vår styrka ligger i våra idéer och vår förmåga att hitta nya, ofta oväntade lösningar som stärker platser och ökar fastigheters värde.      <br /><br />
            Vi följer den globala utvecklingen inom hållbar samhällsutveckling och arbetar aktivt för att integrera hållbara lösningar i alla våra projekt.


        </div>
    </div>

Why does iScroll scroll the hole page and not just the content so that my footer can stay totally fixed without the use of position:fixed which isn't supported in all mobile browsers just yet. 为什么iScroll会滚动页面而不仅仅是内容,以便我的页脚可以保持完全固定而不使用position:fixed,这在所有移动浏览器中都不受支持。

maybe try this widget plug-in for a cleaner integration of iScroll and JQuery Mobile: 也许尝试这个小部件插件,以便更好地集成iScroll和JQuery Mobile:

https://github.com/watusi/jquery-mobile-iscrollview https://github.com/watusi/jquery-mobile-iscrollview

截至目前,页眉和页脚不能在像iscroller这样的jquery移动应用程序中修复。这背后的原因是页眉和页脚放在jquery移动应用程序的页面div中,在iscroller应用程序中页眉和页脚是不是页面div的一部分。但是如果我们试图在jquery移动应用程序中将页眉和页脚保持在页面div之外,则可能会导致错误,例如禁用文本框等。

Forgive me if this is way too obvious but just because it's not included in your code example I thought I'd ask...have you added an id of "content" to your data-role="content" div? 请原谅我,如果这太明显了,只是因为它没有包含在你的代码示例中,我想我会问......你是否在你的data-role =“content”div中添加了“content”的id? That's obviously what your iscroll container should be, but the content div doesn't have a div id in the jqmobile documentation: 这显然是你的iscroll容器应该是什么,但内容div在jqmobile文档中没有div id:

Jquery Getting Started Jquery入门

If you have added that id (which obv. I'm sure you probably have) I'd definitely checkout Phill Pafford's comment above re using pageInit() instead of $(document).ready(). 如果你已经添加了那个id(我相信你可能已经拥有了),我肯定会使用pageInit()代替$(document).ready()来查看Phill Pafford的评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM