I am using a simple jQuery function to fade in all the thumbnail images.
But for some reason each thumbnail bounces a few pixels when the image has finished loading.
Can anybody tell me how to fix this?
This is my CSS:
#portfolio td {padding: 0;}
#portfolio div {width: 240px; height: 150px; background: url(/images/project-frame.png) center center no-repeat; padding: 5px; margin-right: 70px;}
#portfolio div a {display: block; width: 240px; height: 150px; background: url(/images/loader.gif) center center no-repeat;}
#portfolio div a img {width: 240px; height: 150px;}
My jQuery function can be found here: Link to jQuery code (the one at the top)
<div> and <span> have no semantic difference. It’s just that one is an inline element and one is a block, use either as you desire. It was probably whitespace under the image, vertical-align:bottom would have fixed it as well (maybe) along with float:left (maybe ;))
I just suggested div there because it is sitting alongside other block elements, and the span only worked because it was set to display: block. So I figured that a block element was preferable anyway.
I would be asking why the blazes are you making the page-load take twice as long by even using jquery to load the sub-images in the first place? You want to use it for that bloated slow lightbox nonsense, fine - but wrapping the load of six measly thumbnails in javascript for no good reason? Waste of time.
Strip the javascripted nonsense for the ‘loading’ bit off those, use a normal lightbox effect on them, and load them flat… and if you rip out trying to add heights to the TD and instead just declare the width and height on the image, you’ll lose that up and down bouncing effect.
Losing the ‘table for nothing’ wouldn’t hurt much either… and the unneccessary classes couldn’t hurt to take an axe to either - style off the parent.