Brian Brian - 4 months ago 17x
Javascript Question

jQuery hoverIntent: 'Uncaught TypeError: Cannot call method 'apply' of undefined'

I'm using Brian Cherne's

plugin for a project. It's a great plugin but it seems to be broken in jQuery 1.7.1.

I'm trying to debug it but I'm not the most ace javascripter out there. Can anyone tell me what I might need to look for in his code to fix the following error message:

Uncaught TypeError: Cannot call method 'apply' of undefined

That's what my Chrome console tells me. I'm just not sure what to change.

There is the following line of code in the plugin which contains
in the string

return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};


I should post the link to Brian's full commented code. It's here:


My script is as follows

//#nav-main dropdown effects
$('#nav-main ul li').hoverIntent(function () {


Basically hoverIntent requires two functions or one object.

If you put in just one function, it will try to use your function as object and you can't apply a function! So use:

$('#nav-main ul li').hoverIntent(function () {
}, function(){});