Uncaught TypeError: Object [object Object] does not have a 'apply' method

I get this Uncaught TypeError on a new website that I create, but I cannot decide what causes the error.

I recreated the problem from the link below, if you look at the console of JS browsers, you will see an error, but nothing else will happen.

http://jsfiddle.net/EbR6D/2/

the code:

$('.newsitem').hover(
$(this).children('.text').animate({ height: '34px' }), 
$(this).children('.text').animate({ height: '0px'  }));​
+5
source share
4 answers

Be sure to wrap them in asynchronous callbacks:

$('.newsitem').hover(
    function() {
        $(this).children('.title').animate({height:'34px'});
    }, function() {
        $(this).children('.title').animate({height:'0px'});
    }
);
+5
source

You need:

.hover(function(){ ... });

according to the documentation .

+3
source

function...

$('.newsitem').hover(
    $(this).children('.text').animate({height:'34px'}),
    $(this).children('.text').animate({height:'0px'})
);

To:

$('.newsitem').hover(function() {
    $(this).children('.text').animate({
        height: '34px'
    });
}, function() {
    $(this).children('.text').animate({
        height: '0px'
    });
});​

$(this).children('.text') .

+2

use slide animation to handle the height of the .text class.

$('.newsitem').hover(function() {
    $(this).children('.text').slideToggle();
});​
0
source

All Articles