简体   繁体   English

Firefox和IE中的Jquery问题,但Chrome中没有

[英]Jquery issue in Firefox and I.e but not Chrome

Hi we've implemented infinite scroll capabilities within our website. 嗨,我们在网站内实现了无限滚动功能。 All works well within Chrome, but Firefox and Ie are not loading the bellow JavaScript code? 一切都可以在Chrome中正常运行,但是Firefox和Ie是否无法加载下面的JavaScript代码? We do have https, so could that be the issue, if so how do we work around it. 我们确实有https,所以这可能是个问题,如果是的话,我们如何解决这个问题。 Bellow is our current code 波纹管是我们当前的代码

$(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!");
        }
    });
});

Thank you very much! 非常感谢你!

...尝试这个...使用$(window).load代替$(document).ready ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM