另一个'未捕获的TypeError:无法调用方法'应用'未定义'

egr*_*103 10 javascript debugging function typeerror

我的机会很渺茫但我已经通过谷歌尝试了几个解决方案,但似乎没有解决'未捕获的TypeError:无法调用方法'应用'未定义',匿名函数:

在此输入图像描述

如果它本身没有其他JS,但是当它与其他脚本组合在同一页面上时我会收到错误.

它引用的代码行如下,第32行是罪魁祸首.第32行是这一行 - if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }:

var $event = $.event, resizeTimeout;

    $event.special.smartresize  = {
        setup: function() {
            $(this).bind( "resize", $event.special.smartresize.handler );
        },
        teardown: function() {
            $(this).unbind( "resize", $event.special.smartresize.handler );
        },
        handler: function( event, execAsap ) {
            // Save the context
            var context = this,
                args    = arguments;

            // set correct event type
            event.type = "smartresize";

            if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
            resizeTimeout = setTimeout(function() {
                jQuery.event.handle.apply( context, args );
            }, execAsap === "execAsap"? 0 : 100 );
        }
    };
Run Code Online (Sandbox Code Playgroud)

小智 10

我设法通过查看代码来解决这个问题,有一个名为"模拟"的方法,您可以使用它来"回馈捐赠者事件以模拟不同的一个.","假冒原始事件以避免捐赠者的停止传播,但如果模拟事件防止默认,然后我们对捐赠者做同样的事情." 这让我感到震惊,因为"在Brandon Aaron的教程中设置事件类型

代替:

event.type = "myType";
jQuery.event.handle.apply(this, arguments);
Run Code Online (Sandbox Code Playgroud)

使用:

jQuery.event.simulate('myType', this, event);
Run Code Online (Sandbox Code Playgroud)


the*_*tem 5

猜猜你正在加载更新版本的jQuery.看起来好像jQuery 1.9后来没有jQuery.event.handle财产.

据我所知,这从来都不是受支持的财产.

http://jsfiddle.net/xPJN4/