gdzx.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var thisPageIndex = 1;
  2. var thisRow = 30;
  3. var thisLot = window.location.pathname.split(".")[0].split("/")[2]
  4. $(function () {
  5. $(".back").click(function () {
  6. var origin = window.location.origin;
  7. window.location.href = origin + "/zx/index.html";
  8. })
  9. $(".news-item").click(function () {
  10. localStorage.href = window.location.href;
  11. })
  12. setTimeout(wrapperScroll, 1000);
  13. })
  14. function getMore() {
  15. var load = layer.load(2, {
  16. shade: [0.1, '#000']
  17. });
  18. $.ajax({
  19. url: "/ZX/ZXGDList",
  20. type: "post",
  21. async: false,
  22. data: {
  23. c: thisLot,
  24. p: thisPageIndex + 1,
  25. r: thisRow
  26. },
  27. success: function (res) {
  28. layer.close(load);
  29. if (res != "") {
  30. thisPageIndex = thisPageIndex + 1;
  31. $("#v-morezx-wrapper").append(res);
  32. }
  33. else {
  34. layer.msg("没有更多数据了!")
  35. }
  36. },
  37. error: function (err) {
  38. console.log(err);
  39. layer.close(load);
  40. }
  41. })
  42. }
  43. function wrapperScroll() {
  44. var wrapper = $("#v-morezx-wrapper")[0];
  45. wrapper.addEventListener("scroll", function () {
  46. var ch = wrapper.clientHeight;
  47. var st = wrapper.scrollTop;
  48. var sh = wrapper.scrollHeight;
  49. if (st + ch - sh >= -20) {
  50. getMore();
  51. }
  52. })
  53. }