Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

jQuery resize issues

When I mouse over the ".panel" images, it grows by 3 pixels.

However, when I take it off, it shrinks 6 pixels. It gets smaller everytime you mouse over the images.

WTF??

$(document).ready(function() {
    $(".panel").mouseenter(function() {
        $(this).animate({
            height: '+=3px',
            width: '+=3px'
        }, "fast");
    });

    $(".panel").mouseleave(function() {
        $(this).animate( {
            height: '-=3px',
            width: '-=3px'
        }, "fast"); 
    });
});

Hey Evan,

What version of jQuery are you using? I'm using the latest version 2.1.3, and your animation works fine for me.

I dunno. Animation just stopped working out of the blue. Grabbed a new jQuery link, and now it's not functioning right. Must be an older version? Annoying...

I used your exact code with some simple markup I created, and the animation works exactly as intended. If you want to paste the rest of your code, I can try to see what's going on with it.

http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

Looks like I'm using 3.5 year old jQuery.

Still donn't know why that wouldn't work. Seems like pretty vanilla code to me.

Thanks for the help. I wouldn't have thought to even look at the version number if not for your comment.

Do you have other code running besides that?

Ah, so it's working now?

Not able to fix the error yet, but this is code that functioned perfectly ~3-4 weeks ago. No other JS running. It HAS to be the older version.

(Not at main computer. Will fix bug when I get home later)

Like I said, if you want to copy and paste your HTML and CSS here, as well, I can take a look at it and see what's going on.

Problem solved. It was indeed the outdated jQuery. Thanks again.

Oh, that's awesome! Glad you got it solved!