Skip to content Skip to sidebar Skip to footer

Jquery Each(): Variable In Callback Always Has Last Value?

Can't seem to figure out what's going on here.

Solution 2:

why not

$('.navItem > a').hover(
    function() {
        $(this).css('width', '224px');
    },
    function() {
        $(this).css('width', '192px');
    }
);

?

http://jsfiddle.net/Sth3Z/2/

Solution 3:

There is a better way of writing what u are trying to do:

$(".navItem a").hover(
    function() {
        $(this).css('width', '224px');
    },
    function() {
        $(this).css('width', '192px');
    }
);

Post a Comment for "Jquery Each(): Variable In Callback Always Has Last Value?"