123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- var thisWrapper=null;
- var thisPageIndex = 1;
- var thisRow = 30;
- var thisItem = $(".zxzlxq-itemlist.active").data("item");
- var thisType = $(".zxzlxq-itemlist.active").data("type");
- var thisIcon = $("#micon").val();
- $(function () {
- init();
- // setTimeout(wrapperScroll, 1000);
- setTimeout(initScroll, 500);
- $(".back").click(function () {
- var origin = window.location.origin;
- //console.log(origin);
- window.location.href = origin + "/zx/index.html";
- })
- $(".news-item").click(function () {
- localStorage.href = window.location.href;
- })
- $(".zxzlxq-itemlist").click(function () {
- thisWrapper.destroy();
- var index = $(".zxzlxq-itemlist").index(this);
- $(".zxzlxq-itemlist").removeClass("active").eq(index).addClass("active");
- thisItem = $(".zxzlxq-itemlist.active").data("item");
- thisType = $(".zxzlxq-itemlist.active").data("type");
- changeItem();
- })
- })
- function init() {
- var search = window.location.pathname.split(".")[0].split("/")[3];
- if (search != undefined) {
- if (search.indexOf("cstzm") > -1) {
- $(".zxzlxq-itemlist").each(function (i, e) {
- if ($(e).data("type") == "彩神通字谜") {
- $(".zxzlxq-itemlist").removeClass("active").eq(i).addClass("active");
- thisItem = $(e).data("item");
- thisType = $(e).data("type");
- changeItem();
- }
- })
- }
- }
- }
- function changeItem() {
- var load = layer.load(2, {
- shade: [0.3, '#000']
- });
- $.ajax({
- url: "/ZX/ZXLXGD",
- type: "post",
- async: false,
- data: {
- c: thisType,
- m: thisIcon,
- i: thisItem
- },
- success: function (res) {
- layer.close(load);
- if (res != "") {
- thisPageIndex = 1;
- $(".zxzlxq-newslist-wrapper").html(res);
- setTimeout(initScroll,100);
- }
- else {
- layer.msg("没有更多数据了!")
- }
- },
- error: function (err) {
- console.log(err)
- layer.close(load);
- }
- })
- }
- function getMore() {
- var load = layer.load(2, {
- shade: [0.3, '#000']
- });
- $.ajax({
- url: "/ZX/ZXZLXQList",
- type: "post",
- async: false,
- data: {
- c: thisIcon,
- i: thisItem,
- p: thisPageIndex + 1,
- r: thisRow
- },
- success: function (res) {
- layer.close(load);
- if (res != "") {
- thisPageIndex++;
- $("#v-morezx-wrapper .content").append(res);
- thisWrapper.refresh();
- }
- else {
- layer.msg("没有更多数据了!")
- }
- }
- })
- }
- //function wrapperScroll() {
- // var wrapper = $("#v-morezx-wrapper")[0];
- // wrapper.addEventListener("scroll", function () {
- // var ch = wrapper.clientHeight;
- // var st = wrapper.scrollTop;
- // var sh = wrapper.scrollHeight;
- // if (st + ch - sh >= -20) {
- // getMore();
- // }
- // })
- //}
- function initScroll() {
- var wrapper = document.getElementById("v-morezx-wrapper");
- thisWrapper = new BScroll(wrapper, {
- probeType: 1,
- click:true
- });
- thisWrapper.on("scroll", function (pos) {
- var h = $("#v-morezx-wrapper .content")[0].clientHeight;
- var h2 = $("#v-morezx-wrapper")[0].clientHeight;
- if (h-120< Math.abs(pos.y) + h2) {
- getMore();
- }
- })
- }
|