Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var currentAddress = window.location.origin + location.pathname;
- $(window).scroll(function () {
- var that = $(this),
- scroll = that.scrollTop() + that.height(),
- target = $(document).height() - $('footer').height()
- ...
- ...
- if (scroll >= target && searchItemLength > searchLimit - 1 && !isPagination && !isLastPage) {
- isPagination = true;
- sample.search.loading.show();
- sample.ajax({
- url: sample.search.createAjaxUrl(sample.search.updateHash())
- }).done(function (data) {
- if (data.paginationData.totalPage + 1 != data.paginationData.currentPage) {
- ...
- ...
- ...
- window.history.pushState(
- currentAddress,
- null,
- (currentAddress + '&page=') + paginationCount);
- ++paginationCount;
- var lastScrollTop = 0;
- $(window).scroll(function (event) {
- var st = $(this).scrollTop();
- if (st > lastScrollTop) {
- // downscroll
- }
- else {
- //upscrool
- --paginationCount;
- window.history.pushState(
- currentAddress,
- null,
- (currentAddress + '&page=') + paginationCount);
- }
- lastScrollTop = st;
- });
Add Comment
Please, Sign In to add comment