Guest User

Untitled

a guest
May 28th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. var currentAddress = window.location.origin + location.pathname;
  2. $(window).scroll(function () {
  3.  
  4. var that = $(this),
  5. scroll = that.scrollTop() + that.height(),
  6. target = $(document).height() - $('footer').height()
  7. ...
  8. ...
  9. if (scroll >= target && searchItemLength > searchLimit - 1 && !isPagination && !isLastPage) {
  10. isPagination = true;
  11. sample.search.loading.show();
  12. sample.ajax({
  13. url: sample.search.createAjaxUrl(sample.search.updateHash())
  14. }).done(function (data) {
  15. if (data.paginationData.totalPage + 1 != data.paginationData.currentPage) {
  16. ...
  17. ...
  18. ...
  19. window.history.pushState(
  20. currentAddress,
  21. null,
  22. (currentAddress + '&page=') + paginationCount);
  23.  
  24. ++paginationCount;
  25.  
  26. var lastScrollTop = 0;
  27. $(window).scroll(function (event) {
  28. var st = $(this).scrollTop();
  29. if (st > lastScrollTop) {
  30. // downscroll
  31. }
  32. else {
  33. //upscrool
  34. --paginationCount;
  35. window.history.pushState(
  36. currentAddress,
  37. null,
  38. (currentAddress + '&page=') + paginationCount);
  39. }
  40. lastScrollTop = st;
  41. });
Add Comment
Please, Sign In to add comment