だから私は 1 つの jQuery ページの ListView で遅延読み込みを行っています。ListItem をクリックすると、詳細ページが表示されます。問題は、scrollstop
イベントをウィンドウにバインドしたため、詳細ページで遅延読み込みがまだ発生しようとしていることです。
$("#index").on("pageshow", function () {
//get initial list view data
var inital = $('#filters').serialize(); //gets 'filter' params for data-access
RetrieveMeetings(inital); //Populate initial set
//lazy load
//Window Event From: http://stackoverflow.com/questions/9983835/detect-if-user-has-scrolled-to-the-bottom-of-a-div
$(window).bind('scrollstop', function () { //this also fires on details page!!!
var screenBottom = $(this).scrollTop() + parseInt($(window).height());
var $div = $('#meetings-list');
var divBottom = $div.offset().top + parseInt($div.height());
if (screenBottom > divBottom) {
var values = $('#filters').serialize();
LoadMoreMeetings(values);
}
});
//new dataset from filter forum
$("#submit").click(function (event) {
/* stop form from submitting normally */
event.preventDefault();
var values = $('#filters').serialize();
ResetMeetingList();
RetrieveMeetings();
});
});
page
イベントの DOM からを削除することでこれを修正できますpagehide
が、ユーザーが ListView に戻るたびにフィルター フォーラムなどのページ状態が失われます (ページ読み込み時間も長くなります)。
//remove pages from DOM on hide
$(document).on("pagehide", function (e) {
$(e.target).remove();
});
scrollstop
イベントを のpage
代わりにに添付する方法はありwindow
ますか?
このメソッドのもう 1 つの問題は、画面がスクロール バーなしでページをロードするのに十分な大きさである場合、遅延ロードが明らかに起動しないことです。おそらく、この問題に対するより良い全体的な解決策はありますか?