簡體   English   中英

為什么這個jquery沒有在IE8中通過AJAX加載內容?

[英]Why is this jquery not loading content via AJAX in IE8?

IE瀏覽器功能令人驚嘆,令我震驚。 這一次確保jQuery.min文件(谷歌CDN)中的一個可愛的錯誤,從而以某種方式導致我的jquery不通過AJAX加載內容。

這是鏈接: http//themes.thefinishedbox.com/portfolio/

在IE中進行測試之前,單擊任何其他瀏覽器中的頂部鏈接,您將看到他們通過jQuery將外部頁面加載到附加的div中。

我注意到在IE8中它似乎得到加載器圖標並且不加載頁面。 我已經提醒了$ href變量,這似乎是相關的URL。 不確定這里發生了什么?

如果這有幫助,或者你可以只看它RAW:來源http://themes.thefinishedbox.com/portfolio/wp-content/themes/portfolio/js/custom.js?ver=3.1 (你會想要看看第二個$(函數()

$(function() {
    $('#navigation ul > li a').each(function() {

        $(this).click(function(e) {

            $('*').removeClass('active');

            $.ajaxSetup ({  
                cache: false  
            });

            var $this = $(this);

            e.preventDefault();

            var $url = $(this).attr('href'); 

            var $loader = '<div id="whiteLoader" />';

            if($('#page').length === 0) {

                $('<div id="page" />').insertAfter('#header');

                $('#page').queue(function() {
                    $(this).animate({height: '120px'}, 300);
                    $(this).html($loader);
                    $(this).animate({backgroundColor: '#fff'}, 300);
                    $(this).dequeue();                    
                });

                $('#page').queue(function() {
                    $('#page').load($url + ' #pageEntry', function() {
                        var $height = $('#pageEntry').height();
                        var $h = $height + 70;
                        $(this).animate({height: $h + 'px'}, 600, function() {
                            $(this).css({height: 'auto'});
                            $this.addClass('active');
                        });
                    });
                    $(this).dequeue();
                });

            } 

            if($('#page').length == 1 && $('#pageEntry').length == 1) {

                $('#page').slideUp(function() {

                    $(this).remove();
                    $this.removeClass('active');

                    $('<div id="page" />').insertAfter('#header');

                    $('#page').queue(function() {
                        $(this).animate({height: '120px'}, 300);
                        $(this).html($loader);
                        $(this).animate({backgroundColor: '#fff'}, 300);
                        $(this).dequeue();                    
                    });

                    $('#page').queue(function() {
                        $('#page').load($url + ' #pageEntry', function() {
                            var $height = $('#pageEntry').height();
                            var $h = $height + 70;
                            $(this).animate({height: $h + 'px'}, 600, function() {
                                $this.addClass('active');
                            });
                        });
                        $(this).dequeue();
                    });

                });
            }

            $('.closex').live('click', function() {
                $(this).parent().parent().slideUp(function() {
                    $(this).remove();
                    $('*').removeClass('active');
                });
            });

        });

    });
}); 

任何幫助都將受到大力贊賞!

問題是您正在嘗試為背景顏色設置動畫

$(this).animate({backgroundColor: '#fff'}, 300);

除非您包含jQuery UI( 實現此功能 ),否則不支持此操作

因此,您傳遞的是無效輸入,它會導致IE扼流。

閱讀錯誤http://bugs.jquery.com/ticket/7256了解更多信息..

包括對jquery UI腳本的引用可以修復它( 測試 )或注釋掉該行( 因為背景已經是白色 )。

您是否嘗試過升級到最新版本的jquery? 當前版本是1.5.2,看起來你正在使用1.4.2。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM