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

CSS

Moving images: CSS3 animations or Javascript

So I want to be able to move some images on a website I am coding and I was wondering if it is possible to do with CSS3 Animations or will I need to learn some javascript to make it happen.

Essentially what I want is when I click on a link for all the images on that page to move to either the right or left side. If anyone has any ideas how would be best to achieve something like that I would really appreciate it. (also if I'm not explaining this clearly please let me know)

First forum post but super excited about this community and already have learned a ton! Thanks tree house team for making quality videos. Codeschool was not the greatest...

2 Answers

Vance Rivera
Vance Rivera
18,323 Points

I would probably go with jquery for this particular situation. Sure i believe you can figure this out with CSS3 animations using the @keyframes but unfortunately you can potentially run into cross browser compatibility issues (IE 9 or earlier doesn't support CSS3 Animations). With your concept in mind you basically want to trigger an event based off .click event handler. I'd suggest adding Jquery.com to your list of favorite sites because the API documentation is extensive, in depth, and they provide great examples. For your case in particular I would read through .click event handler section and .animate section. This will definitely get you moving in the right direction.

Awesome. Thanks vance I will look into it and see if I can figure it out with some studying. Much appreciated.