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

how i can do that ?

hey i m creating an lightbox with next and prev option but i also want to show load gif till the image is not load how i can do that

Felix Yakubov
Felix Yakubov
17,475 Points

Are you using a jQuery plugin? If so check if there is an option in the documentation If not you can search for a plugin that does that. Or you can try the lazy load method

huckleberry
huckleberry
14,636 Points

Felix Yakubov I think they're just learning jQuery now and plugins may be wooosh over their heads atm (but you never know!). However, I'd really appreciate an explanation of the lazy load thing you're talking about :)

Thanks!

Cheers,

Huck - :sunglasses:

Felix Yakubov
Felix Yakubov
17,475 Points

@huckleberry

Lazy Load (wiki entry): Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed.

Example: lets say you have a page which has a gallery near the footer. Why waste time and wait until the images load if you don't need them right now (or maybe at all if user won't slide down). Lazy loading lets you load those images only if user needs to see them. https://css-tricks.com/examples/LazyLoading/

Some plugins using lazy load:

http://kenwheeler.github.io/slick/ http://www.appelsiini.net/projects/lazyload

Its one of the main JS optimization tricks you can use to speed up your website (making it more user friendly and seo friendly) Async loading uses the same idea but with js files

Enjoy!