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 Basics (2014) Creating a Simple Lightbox Perform: Part 4

Alex Wylie
Alex Wylie
4,364 Points

caption appears at first, then after image loads, it moves down?

Hey guys, just a quick question.

I followed along with this lesson fine, but when i got to testing the final product, i noticed that when i click the image, the caption (ie the alt attribute) loads first at the top of the page, and then once the image loads it moves under the image.

Am i doing something wrong?

1 Answer

Steven Parker
Steven Parker
229,644 Points

That sounds normal for when no size has been established for the image.

But if you know the image size in advance, you can establish it with either CSS or attributes of the img tag. Then the other elements affected by it will render at their final positions initially.