簡體   English   中英

意外調用方法或屬性。 的jquery.js?版本1.7.1 =

[英]Unexpected call to method or property access. jquery.js?ver=1.7.1

我在IE7中收到“對方法或屬性訪問的意外調用”,而我的腳本在IE8中無法正常工作,我一生都無法弄清原因。

我一直在IE中使用開發人員工具(woohooo!),但並沒有太大幫助。 我得到的錯誤是在Jquery中:

SCRIPT65535:對方法或屬性訪問的意外調用。 jquery.js?ver = 1.7.1,第3行字符31871

它在IE9,Safari,FF和chrome中可以正常工作。

在“ HTML”頁面上,我單擊以下鏈接,該鏈接將數據稅屬性的值傳遞給腳本。 您認為它可能與html5有關系嗎? 任何指針將不勝感激。

例如,如果您單擊Brad Pitt,它將顯示Brad Pitt所在的電影:

<li class="ajaxFilterItem brad-pitt af-actor-6 filter-selected" data-tax="actor=6"><a href="#" class="ajax-filter-label"><span class="checkbox"></span>Brad Pitt</a> (1)</li>

我將以下值傳遞給

filterAjaxify("actor=6")

這是令人反感的代碼:

(function($){
    var isRunning = false;
    // Return an array of selected navigation classes.
    function loopSelected(_node) {
        var _arr = [];
        _node.each(function(){
            var _class = $(this).attr('data-tax');
            _arr.push(_class);
        });
        return _arr;
    };

    // Animate the progress bar based on Ajax step completion.
    function increaseProgressBar(percent){
        $('div#progbar').animate({
            width: percent + '%'
        },30);
    };

    // Join the array with an & so we can break it later.
    function returnSelected(){
        var selected = loopSelected($('li.filter-selected'));
            return selected.join('&');
    };

    // When the navigation is clicked run the ajax function.
    $('a.ajax-filter-label, a.paginationNav, a.pagelink').live('click', function(e) {
        if(isRunning == false){
            isRunning = true;
            e.preventDefault();
            var relation = $(this).attr('rel');
            if($(this).parent('li').length > 0) {
                $(this).parent('li').toggleClass('filter-selected');
                thisPage = 1;
            }
            if(relation === 'next'){
                thisPage++;
            } else if(relation === 'prev') {
                thisPage--;
            } else if($(this).hasClass('pagelink')){
                thisPage = relation;
            }
            filterAjaxify(returnSelected());
        }
    });

    // Do all the ajax functions.
    function filterAjaxify(selected){
        $.ajax({
            url: ajaxurl,
            type: 'post',
            data: {
                "action":"affilterposts",
                "filters": selected,
                "posttypes": posttypes,
                "qo": qo,
                "paged": thisPage,
                "_ajax_nonce": nonce
            },
            beforeSend: function(){
                $('div#ajax-loader').fadeIn();
                $('section#ajax-filtered-section').fadeTo('slow',0.4);
                increaseProgressBar(33);
            },
            success: function(html){
                increaseProgressBar(80);
                $('section#ajax-filtered-section').html(html);
            },
            complete: function(){
                $('section#ajax-filtered-section').fadeTo('slow',1);
                increaseProgressBar(100);
                $('div#ajax-loader').fadeOut();
                isRunning = false;
            },
            error: function(){}
        });
    };
})(jQuery);

<section>是HTML5中的新功能,較舊的IE不知道該如何消化,並且在嘗試將內容附加到此類元素時會出現DOM問題。

例如http://jsfiddle.net/EKU7R/

暫無
暫無

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

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