繁体   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