Jquery问题在Firefox和IE中,但不是Chrome

Jquery issue in Firefox and I.e but not Chrome

本文关键字:Chrome IE 问题 Firefox Jquery      更新时间:2023-09-26

嗨,我们已经在我们的网站中实现了无限滚动功能。在Chrome中一切正常,但是Firefox和IE没有加载下面的JavaScript代码吗?我们确实有https,所以这可能是问题所在,如果是这样,我们如何解决它。波纹管是我们当前的代码

$(document).ready(function () {
    var ajax_arry = [];
    var ajax_index = 0;
    var sctp = 100;
    $('#loading').show();
    $.ajax({
        url:"ajax.php",
        type:"POST",
        data:"function=showData&type=homeactivity&page=1",
        cache: false,
        success: function (response) {
            $('#loading').hide();
            $('#postStatus1').html(response);
        }
    });
    $(window).scroll(function () {
        var height = $('#postStatus1').height();
        var scroll_top = $(this).scrollTop();
        if(ajax_arry.length>0) {
            $('#loading').hide();
            for(var i=0; i<ajax_arry.length; i++) {
                ajax_arry[i].abort();
            }
        }
        var page = $('#postStatus1').find('.nextpage').val();
        var isload = $('#postStatus1').find('.isload').val();
        if($(window).scrollTop() == $(document).height() - $(window).height() && isload=='true') {
            $('#loading').show();
            var ajaxreq = $.ajax({
                url: "ajax.php",
                type: "POST",
                data: "function=showData&type=homeactivity&page="+page,
                cache: false,
                success: function (response) {
                    $('#postStatus1').find('.nextpage').remove();
                    $('#postStatus1').find('.isload').remove();
                    $('#loading').hide();
                    $('#postStatus1').append(response);
                }
            });
            ajax_arry[ajax_index++] = ajaxreq;
        }
        return false;
        if($(window).scrollTop() == $(window).height()) {
            alert("bottom!");
        }
    });
});

谢谢!

...试试这个...使用 $(window).load 而不是 $(document).ready...