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

is this possible or not ?

  if(cur_pos>360){
              $('.intro').delay(1500).animate(
                   {  
                      transform:scale(1.5) },'slow'
                );
            }

1 Answer

Steven Parker
Steven Parker
243,318 Points

I think you can only animate numeric properties. The value for transform may have a number in it, but it's a string.

:point_right: You could scale it yourself by animating the dimensions:

if (cur_pos > 360) {
    $('.intro').delay(1500).animate({
        height: '150%',
        width: '150%'
    }, 'slow');
}

:point_right: Or, you can also get the same effect by combining transform with a transition (no "animate"):

style.css
.intro {
    transition: transform 600ms 1.5s;  /* "slow", with a 1500ms delay */
}
script.js
if (cur_pos > 360) {
    $('.intro').css('transform', 'scale(1.5)');
}

Happy coding! :computer: