View Full Version : Image Thumbnail Viewer - Image not centered

03-26-2012, 11:03 PM
1) Script Title: Image Thumbnail Viewer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm

3) Describe problem: Image is not centered

Hello there!

I have recently decided to use your very nice Thumbnail Viewer, but I really don't understand what may be the problem with it or why it is not centering the images.

On my 19 inch monitor the large image that pops out has a significant offset and because of that a horizontal scroll appears.

I have built a short example to illustrate the issue, nothing more than a few nested divs with relative positioning.
I also tried position: fixed; for the #thumbBox and this centered the image but since I have very tall images, only half of them would have been visible.


I would really appreciate if you'd explain to me why does this happen or what should I improve to make it work.

Thank you in advance and best regards from Romania :)

Gabriel F.

03-27-2012, 09:52 AM
problem with your css, remove the red

body {
position: relative;
min-height: 100%;
margin: 0 auto;
width: 950px;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
color: #000000;
text-align: left;
border: solid 5px #0099CC;

03-27-2012, 10:29 PM
Yes, works great now :)
I've simply shifted margin: 0 auto; to the wrapper. Many thanks and keep up the good job!

12-01-2012, 04:31 PM
I'm having a similar problem. The first time I click on the picture, the large picture is centered as it should be, each subsequent time you click the thumbnail, it's offset. I've used this script on a few sites and never noticed it before now. An example is here:


I've tested on Chrome & IE, and the bug only seems to be with Chrome.


12-01-2012, 04:36 PM
Update: http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm has the same bug for Chrome, so perhaps it isn't just me.

12-01-2012, 04:37 PM
My other post didn't show up (or had to be approved) - but my update did - so this is out of order I guess! Sorry...

In Chrome when you click on the thumbnail it opens the large image as it should be (centered) - but if you close the enlarged image and re-click on the thumbnail, the image is off-set. Thoughts?