«« back to do-boy.com

Download files used in this page
adolberg.jpg aliuson.jpg amemon.jpg aortiz.jpg bchin.jpg bdefore.jpg bobsc.jpg bsnyder.jpg cbedford.jpg csimmons.jpg cwalcott.jpg djacowitz.jpg dmeketa.jpg dougb.jpg dsemenova.jpg dspells.jpg egoethals.jpg eirizarr.jpg ekung.jpg enorton.jpg esmith.jpg ewong.jpg gnayak.jpg hsharma.jpg hsilin.jpg hwoo.jpg icaverobelaunde.jpg ichase.jpg ishen.jpg jchang.jpg jchochondavis.jpg jec.jpg jeffa.jpg jloftus.jpg jmayhew.jpg jrowe.jpg jsclark.jpg jswartz.jpg jvillegas.jpg jyeh.jpg kcunningham.jpg keckey.jpg ksenno.jpg ktoley.jpg larruda.jpg lkhong.jpg mbozza.jpg mclark.jpg mdominguez.jpg mdowney.jpg mgardine.jpg moba.jpg mogawa.jpg mschroeder.jpg msepulveda.jpg mwang.jpg mwilliams.jpg nrajbhandari.jpg pbetlem.jpg pblaha.jpg pgrandmaison.jpg pkohlhaas.jpg pmoody.jpg pmowrer.jpg probertson.jpg ptao.jpg rconti.jpg rpenner.jpg rsanjuan.jpg rsun.jpg rwilliams.jpg sannam.jpg sgarre.jpg shayhurst.jpg skhong.jpg skranzberg.jpg smcginn.jpg smuthyam.jpg srahim.jpg srao.jpg syoon.jpg taljaber.jpg tderich.jpg tklubock.jpg tmowatt.jpg vvirgillito.jpg wstiefel.jpg ykondodelatorre.jpg yshimizu.jpg

As the page loads, two variables are declared, imagesLoaded and imagesTotal. Since later on there’s a calculation containing imagesLoadedimagesTotal you can’t let imagesTotal be zero. (Theoretically can’t happen, but you want to be careful.)

Once the DOM is available, a function is attached to each IMG element’s load event, in which imagesLoaded is incremented and the progress bar is updated. As each image loads, it triggers the attached function which updates the progress bar with the new % loaded value.

When imagesLoaded == imagesTotal, all images have loaded and triggered the load function, so we can hide the progress bar and show the page’s contents.

For fun, click an image.

This page uses jQuery and the Progress Bar Plugin from http://digitalbush.com/.