1

計画は、ページ内に読み込みスクロール付きのスクロールを追加することでした。2つの問題:読み込みスクロールが機能しない&読み込みスクロールを実装するためにiframeを使用する必要があるかどうかわかりません。主な理由は、div内にソート可能でドロップ可能なjQueryがあり、iframeの外にドラッグできるかどうかわからないためです。任意のアイデアをいただければ幸いです

$(#win).scroll(function(){
//replaced window with #win, which is the id of the div containg database info
    if($(this)[0].scrollTop() == $(this)[0].height()- $(this).height()){

        //everytime we scroll we have this function activated
    //if statement is saying if we're at the bottom of the page
        //$('div#text').hide();
        $('div#loadMoreComments').show();
    //.show is showing the div above which has the loading animation

    $.ajax({
    url: "loadem.php?lastComment="+ $(".postedComment:last").attr("id"),
     //using get variable to say last comment is equal to + posted 
    //comment which is the last comment that's displayed &
    //that last comment has an id 
    success: function(html){
        if (html){
            $("#postedComment").append(html);
            //if we are at the bottom we will add comments to the page
            //and hide the animation
            $('div#loadMoreComments').hide();
            //$('div#text').show();


        }else{
            $('div#loadMoreComments').replaceWith("<div class='box'><center>Finished Loading</center></div>");
        //if theres no more to scroll then the finished loading will show
        }
    }
    });

    }
});
4

1 に答える 1

0
if((jQuery(window).scrollTop()) > (jQuery(document).height() - jQuery(window).height()))
{
 ...... YOUR CODE IS HERE.....
}

このコードは、ページの継続的なページネーションを機能させます。私が懸念している限り、ソート可能でドロップ可能な原因には影響しません。ページネーション div がすべての子要素をカバーしていると言ったからです。

これが役立つことを願っています。

于 2012-08-20T14:10:12.993 に答える