tags:

views:

58

answers:

2

I have an image viewer using a js module called "cloud zoom."

It works wonderfully and seems to be just what I need. Except! It messes up the viewer when I try and center the IMG in a div.

Here is my unfortunate example. Roll over the image and you will see that the mouse and the view don't match up. It works fine if I were to remove the auto margin style on the IMG. I just need that image in the middle of the div.

http://forumgallery.rollinleonard.com/test2.php

Please help!

+2  A: 
  1. Remove the auto margin from the IMG
  2. Add the auto margin to the A tag enclosing the IMG
  3. Set the A tag to display: inline-block
babtek
Thank you for your very logical response! I followed your instruction and it seemed to have the same effect as doing nothing. This is what led to be believe something in the js file linked in the Head had something to do with it, but I wasn't able to figure out what. I've updated the link to include your suggested change. http://forumgallery.rollinleonard.com/test.php Any further ideas? Thanks again!
Rollin
The A tag is still showing as "display:block" for me, you need to make it "display:inline-block"
babtek
oooh, shoot. thanks!
Rollin
+2  A: 

Something like this seems to work okay in IE8/Chrome.

<div style="display:inline-block; margin: 0 auto 0 auto"> 
     <a href='/big.jpg' class='cloud-zoom' id='zoom1' rel=""><img src="/small.jpg" alt='' title="Optional title display" /></a> 
    </div> 
WSkid
Thank you so much... I really wish I hadn't banged my head against the wall for hours before coming here. Maybe it is better I learned with all the pain? No pain, no gain? I don't know... Any book recommendations that would get me up to speed?
Rollin
My workplace has some corporate discount thing with O'Reilly, so my book reading is a bit limited but I've used, http://oreilly.com/catalog/9780596527334/quite a bit. One of the key concepts is the block model (which helped here) and it has one of the better explanations I've come across.
WSkid
Great. Thanks again. I will look into getting that book.
Rollin