search with endless scrolling

This commit is contained in:
Jörn Friedrich Dreyer 2015-01-05 13:53:56 +01:00
parent 23900a5a39
commit ba931d2124
2 changed files with 7 additions and 5 deletions

View File

@ -5,10 +5,8 @@
#searchresults {
background-color:#fff;
overflow-x:hidden;
overflow-y: auto;
text-overflow:ellipsis;
padding-top: 65px;
height: 100%;
box-sizing: border-box;
z-index:75;
}

View File

@ -81,6 +81,7 @@
var currentResult = -1;
var lastQuery = '';
var lastInApps = [];
var lastPage = 0;
var lastSize = 30;
var lastResults = {};
@ -115,6 +116,7 @@
return;
}
lastQuery = query;
lastInApps = inApps;
lastPage = page;
lastSize = size;
@ -234,9 +236,11 @@
*/
function onScroll(e) {
if ($searchResults) {
//if ( $searchResults && $searchResults.scrollTop() + $searchResults.height() > $searchResults.find('table').height() - 300 ) {
// self.search(lastQuery, lastPage + 1);
//}
var resultsBottom = $searchResults.offset().top + $searchResults.height();
var containerBottom = $searchResults.offsetParent().offset().top + $searchResults.offsetParent().height();
if ( resultsBottom < containerBottom * 1.2 ) {
self.search(lastQuery, lastInApps, lastPage + 1);
}
placeStatus();
}
}