I’m trying to do an inter-fading slideshow JS.
it works perfectly if all the images are in position: absolute, under the parentdiv.
Problem arises when there are images with different orientations and aspect ratios, they all stick to the upper-left corner of the parent div when I want them to align with the center (both horizontal and vertical) of thediv.
If I change them to position:relative, they would appear next to the existing image while starting to fade in because the original hasn’t faded out yet.
Any ideas are greatly appreciated.
http://jsfiddle.net/chocobo/ERH54/9/
(all credit goes to the original author: Torsten Baldes)
EDIT: Horizontal-centering is made possible, how about vertical-centering?
I’m not suggesting this is the best way, but it works:
Start by wrapping your images in list item elements. Add the following class to your CSS:
Next, wrap your images within div elements and style them with text-align: center. Hopefully you should see your images aligned horizontally down the middle.