阿贾克斯preloader不工作在Chrome,Safari浏览器在Firefox中工作时工作、浏览器、preloader、阿贾克斯

2023-09-10 14:06:33 作者:青梅已熟竹马已腿

我在阿贾克斯装载机形象的问题。在Firefox它工作正常,但对铬阿贾克斯装载机图像不看来。

I have a problem in "Ajax Loader image". On Firefox it is working fine but on chrome that ajax loader image does not seems.

我在侧边栏的某些属性,当我检查,根据它和Ajax completed.What我做以前发生的preloader图像中的任何属性,产品的变化是,当我检查任何属性首先我插入了gif图片DIV HTML并显示使用它.show()方法和Ajax的成功后,我设置的div HTML空藏起来。

I have a some attributes on sidebar when I check any attribute Products changes according with it and a Preloader image generated before ajax completed.What I am doing is when I check on any attribute first I insert a gif image in div html and show it using .show() method and after success of ajax I set div html null and hide it.

您可以看到萤火虫的格(< D​​IV ID =ajax_loader_div的风格=显示:无;>< / DIV>

You can see that div in firebug (<div id="ajax_loader_div" style="display:none;"></div>)

code真的很复杂,这就是为什么我没有张贴code here.Really很抱歉that.You可以看到它的 http://vcompare4u.com/wpcompare/products/laptops/

Code is really complicated that's why I am not posting code here.Really very Sorry for that.You can see it on http://vcompare4u.com/wpcompare/products/laptops/

我需要help.Please 谢谢!

I need help.Please Thanks!!!

推荐答案

我看过你的code

是公知的同步请求将锁定用户界面。因此,不出意外的Chrome和Safari,(它在Firefox中有趣的)

It is well known a synchronous requests will lock the UI. So not surprisingly on chrome and safari, (it does in Firefox interestingly)

您可以尝试这样的事

jQuery('#customtag_widget-2 .compare_attribute').bind('change', 

jQuery.filterProductsCompare2 = function () {
$.ajaxSetup({async:false});
jQuery('#ajax_loader_div').css('display', 'block');
jQuery('#ajax_loader_div').html('<img src="https://m.xsw88.com/allimgs/daicuo/20230910/212.png.gif" / >');

jQuery('#customtag_widget-2 .compare_attribute_group').each(function () {



        jQuery(this).children().each(function () {

            if (jQuery(this).children('.compare_attribute').attr('checked')) {

                if (jQuery(this).children('.compare_attribute').attr('name').indexOf('b[') != -1) {

                    brands.push(jQuery(this).children('.compare_attribute').attr('value'));

                }

                if (jQuery(this).children('.compare_attribute').attr('name').indexOf('c[') != -1) {

                    categories.push(jQuery(this).children('.compare_attribute').attr('value'));

                }

            }

        })

    } else {

        minmaxarr = jQuery(this).attr('value').split(';');

        minPrice = minmaxarr[0];

        maxPrice = minmaxarr[1];

    }

    if (!jQuery.support.placeholder) {

        if (isEmptyPlaceholder == 1) {

            jQuery(this).val('Search...');

        }

    }

})

if (jQuery('#dont_change_price').is(':checked')) {
    minPrice = jQuery('#overall_min').val();
    maxPrice = jQuery('#overall_max').val();
} else {}

jQuery.ajax({

    url : file_url,
    data : {
        ajaxsearch : '1',
        s : 'compare',
        ki : keywords_comparei,
        product : '',
        c : categories,
        b : brands,
        checked_id : checked_string,
        dont_change_price : dont_change_price,
        min : minPrice,
        max : maxPrice,
        product_category : product_category
    },
    success : function (data) {
        // Do stuff here
    }
});

jQuery.ajax({
    url : bracket_file_url,
    data : {
        ajaxsearch : '1',
        s : 'compare',
        ki : keywords_comparei,
        product : '',
        c : categories,
        b : brands,
        checked_id : checked_string,
        min : minPrice,
        max : maxPrice,
        product_category : product_category
    },
    success : function (bracket_data) {
        // DO stuff here
    }

});
if (!jQuery('#dont_change_price').is(':checked')) {
jQuery.ajax({

    url : price_file_url,
    data : {
        ajaxsearch : '1',
        s : 'compare',
        ki : keywords_comparei,
        product : '',
        c : categories,
        b : brands,
        checked_id : checked_string,
        min : minPrice,
        max : maxPrice,
        product_category : product_category

    },

    success : function (price_data) {

        // DO stuff here

    }

});
}
jQuery('#ajax_loader_div').hide();
jQuery('#ajax_loader_div').html('');


$.ajaxSetup({async:true});
});

我所试图做的是做,而不是使用成功的功能,我使用Ajax请求单独每个Ajax请求和同步请求。由于同步特性每个请求将被处理了一个又一个。

What I am trying to do is to do synchronous request for each ajax request and instead of using success functions I am using ajax request separately. Due to synchronous nature each request will be processed one after another.

检查你的code镀铬控制台我见过的ajax装载机很少的那一刻立即得到藏起来。

Inspecting your code in chrome console I've seen ajax loader for very little moment get hided immediately.

下面是引用的问题同样喜欢你。

here is reference problem same like yours

Force同步&QUOT前右;阿贾克斯&QUOT;在Webkit内核(Chrome浏览器Safari浏览器和放大器)的用户界面重绘;申请