Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/403.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用ajax调用的Mobile safari崩溃_Javascript_Jquery_Ios_Ajax_Wordpress - Fatal编程技术网

Javascript 使用ajax调用的Mobile safari崩溃

Javascript 使用ajax调用的Mobile safari崩溃,javascript,jquery,ios,ajax,wordpress,Javascript,Jquery,Ios,Ajax,Wordpress,您好,我有一个网站,我正在用ajax加载滑块。它在桌面和android上运行得很好,但在IOS Iphone上,在加载第二行滑块Safari崩溃后。我的代码中有错误吗?什么会导致我的错误 我使用wordpress自定义查询,并在页面上为2个自定义类型显示1个滑块。这是我的html 我想补充的是,滑块有大图片 currentPage = 2; containerItemSelector = ".home-row"; postItemSelector = ".left-col"; conta

您好,我有一个网站,我正在用ajax加载滑块。它在桌面和android上运行得很好,但在IOS Iphone上,在加载第二行滑块Safari崩溃后。我的代码中有错误吗?什么会导致我的错误

我使用wordpress自定义查询,并在页面上为2个自定义类型显示1个滑块。这是我的html 我想补充的是,滑块有大图片

    currentPage = 2;
containerItemSelector = ".home-row";
postItemSelector = ".left-col";
containerItemSelector2 = ".home-row";
postItemSelector2 = ".right-col";
counter = 1;
allow = true;
$(window).scroll(function() {
  if(allow && $(window).scrollTop() + $(window).height() > $(document).height()-100) {
    allow = false;
    $.ajax({
      type: "GET",
      url: "<?php echo $_SERVER["REQUEST_URI"] ?>?paged=" + currentPage,
      data: "",
      success: function(results) {
        var item = $(containerItemSelector + " > " + postItemSelector, results);
        item.each(function(i) {
          $(containerItemSelector).append($(this));
          $(this).find('.description').fadeIn(500);
          var slider = $(this).find('.slider-left').attr('id');
          jssor_slider_left.push(new $JssorSlider$(slider, options1));
          var total = jssor_slider_left.length - 1;
          var parentWidth = jssor_slider_left[total].$Elmt.parentNode.clientWidth;

            if (parentWidth)
                jssor_slider_left[total].$ScaleWidth(Math.min(parentWidth,954));
            else
                window.setTimeout(scales, 30);
            $(this).find('.img-wrap2').fadeOut(1500, function(){
                $(this).remove();
            });
            if(counter % 2 == 0){
                $(this).closest('.right-col').after("<div class='clearfix'> </div>");

        }
        counter++;
        });
            var item1 = $(containerItemSelector2 + " > " + postItemSelector2, results);
        item1.each(function(i) {
          $(containerItemSelector2).append($(this));
          $(this).find('.description').fadeIn(500);
          var slider2 = $(this).find('.slider-right').attr('id');
          jssor_slider_right.push(new $JssorSlider$(slider2, options1));
          var total1 = jssor_slider_right.length - 1;
          var parentWidth1 = jssor_slider_right[total1].$Elmt.parentNode.clientWidth;
            if (parentWidth1)
                jssor_slider_right[total1].$ScaleWidth(Math.min(parentWidth1,954));
            else
                window.setTimeout(scales, 30);

            $(this).find('.img-wrap2').fadeOut(1500, function(){
                $(this).remove();
            });
            if(counter % 2 == 0){
                $(this).closest('.right-col').after("<div class='clearfix'> </div>");

        }
        counter++;


        });

       currentPage++;
       allow = true;
      },
      error: function(results) {
        if(results.status == 404) {
          $(".xhrStatus").html('No more posts to show...');
        }
        else {
          $(".xhrStatus").html('Error retrieving posts...');
        }
      }

    });
  }
  return false;
});
currentPage=2;
containerItemSelector=“.home行”;
positemselector=“.left col”;
containerItemSelector2=“.home行”;
postItemSelector2=“.right col”;
计数器=1;
允许=真;
$(窗口)。滚动(函数(){
如果(允许&&$(窗口).scrollTop()+$(窗口).height()>$(文档).height()-100){
允许=假;
$.ajax({
键入:“获取”,
url:“?paged=“+currentPage,
数据:“,
成功:功能(结果){
变量项=$(containerItemSelector+“>”+postItemSelector,结果);
项目.每个(功能(i){
$(containerItemSelector).append($(this));
$(this.find('.description').fadeIn(500);
var slider=$(this.find('.slider left').attr('id');
jssor_slider_left.push(新$JssorSlider$(slider,options1));
var total=jssor_slider_left.length-1;
var parentWidth=jssor\u slider\u left[total]。$Elmt.parentNode.clientWidth;
如果(父宽度)
jssor_slider_left[total].$ScaleWidth(Math.min(parentWidth,954));
其他的
设置超时(刻度,30);
$(this).find('.img-wrap2').fadeOut(1500,function(){
$(this.remove();
});
如果(计数器%2==0){
$(this).最接近('.right col')。在(“”)之后;
}
计数器++;
});
var item1=$(containerItemSelector2+“>”+postItemSelector2,结果);
项目1.每个功能(一){
$(containerItemSelector2)。追加($(this));
$(this.find('.description').fadeIn(500);
var slider2=$(this.find('.sliderright').attr('id');
jssor_slider_right.push(新的$JssorSlider$(slider2,选项1));
var total1=jssor_滑块_right.length-1;
var parentWidth1=jssor\u slider\u right[total1]。$Elmt.parentNode.clientWidth;
如果(1)
jssor_slider_right[total1]。$ScaleWidth(Math.min(parentwidth1954));
其他的
设置超时(刻度,30);
$(this).find('.img-wrap2').fadeOut(1500,function(){
$(this.remove();
});
如果(计数器%2==0){
$(this).最接近('.right col')。在(“”)之后;
}
计数器++;
});
currentPage++;
允许=真;
},
错误:函数(结果){
如果(results.status==404){
$(“.xhrStatus”).html('不再显示帖子…);
}
否则{
$(“.xhrStatus”).html('检索帖子时出错…);
}
}
});
}
返回false;
});

你能缩小崩溃发生的范围吗?是的,就像我在第一页加载时说的,我得到了一行2个滑块,然后当我向下滚动并加载第二页滑块时,崩溃出现了。我是说代码中的什么地方。我想问问题出在ajax调用中。但我不确定。