简体   繁体   English

在Android + PhoneGap中滚动添加帖子

[英]Add Posts on Scrolling in Android+PhoneGap

I am working on application that is using JQuery Mobile and PhoneGap API for android My application has a page for news feed that displays 10 news feed at one time and then Below a button for display next 10 news feeds it works fine and display the other 10 untill all news feeds displayed Now i want it that for display next 10 posts user not click on button just scroll down and loads the other 10 posts (It is app for Android OS) 我正在使用正在使用Android的JQuery Mobile和PhoneGap API的应用程序,我的应用程序有一个新闻提要页面,该页面一次显示10个新闻提要,然后在一个按钮下显示接下来的10个新闻提要,它可以正常工作并显示其他10直到显示所有新闻提要现在我要显示下10个帖子,用户不要单击按钮,只需向下滚动并加载其他10个帖子(这是Android OS的应用程序)

Is there any plugin or anything else that i can use My App Structure is like (in this structure One full post display) 我可以使用“我的应用程序结构”是否有任何插件或其他任何东西(在此结构中,一个完整的帖子显示)

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

Use pull to refresh of iScroll. 使用拉动刷新iScroll。 Demo here 在这里演示


Example: 例:

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

OR: 要么:

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

And in javascript: 并且在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)
    }
});

i did it with custom way as 我用自定义方式做到了

$(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
    }
}
});

This is basic according to demo maybe I need little modifications but not major Thanks 根据演示,这是基本的,也许我需要一些修改,但不需要主要的感谢

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

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