簡體   English   中英

在Android + PhoneGap中滾動添加帖子

[英]Add Posts on Scrolling in Android+PhoneGap

我正在使用正在使用Android的JQuery Mobile和PhoneGap API的應用程序,我的應用程序有一個新聞提要頁面,該頁面一次顯示10個新聞提要,然后在一個按鈕下顯示接下來的10個新聞提要,它可以正常工作並顯示其他10直到顯示所有新聞提要現在我要顯示下10個帖子,用戶不要單擊按鈕,只需向下滾動並加載其他10個帖子(這是Android OS的應用程序)

我可以使用“我的應用程序結構”是否有任何插件或其他任何東西(在此結構中,一個完整的帖子顯示)

<div id="newsfeed_52" class="postwrapper">
    <div id="post_52" class="feeds-content">
        <div class="feeds-content-header"></div>
        <div class="harvestactivity"></div>
        <div class="hs-post-actions"></div>
    </div>
</div>

使用拉動刷新iScroll。 在這里演示


例:

    <div id="wrapper">
        <div id="scroller">
            //append anything when pull up: div, ul,...
            <ul id="items">
                //Append items when pull up.
            </ul>
            <div>scroll up to add more item</div>
        </div>
    </div>

要么:

    <div id="wrapper">
        <ul id="items">
            //Append items when pull up.
        </ul>
    </div>

並且在javascript中:

myScroll = new iScroll('wrapper', {
    onScrollMove:function(){
        //do something when scroll move(identify position of scroll)
    },
    onScrollEnd:function(){
        //do something when scroll end(add more items)
    }
});

我用自定義方式做到了

$(window).scroll(function (e)
{
if( ( $.mobile.activePage[0].id == 'PageIdInWhichYouWantToAppyThis' )
{
    if ( $(document).height() == $(window).scrollTop() + $(window).height() )
    {
        //here you can auto trigger that link which previously Waiting User Click
    }
}
});

根據演示,這是基本的,也許我需要一些修改,但不需要主要的感謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM