Home › Forums › JavaScript › Help using jQuery to center an element horizontally and vertically over varying image dimensions. › Re: Help using jQuery to center an element horizontally and vertically over varying image dimensions.
@akeenlabs – thanks for the comment. I was typing a response when I suddenly figured this out in css through good-ole’ firebug. I’m still using jQuery to append the tags and for the animations, but adjusted my css as follows;
ul.thumbnails a span {
display: none;
background-image:url(../images_layout/magnifyingglass.png);
background-repeat: no-repeat;
width: 50px;
height: 50px;
position: absolute;
margin-left: -25px; /* negative half of width to adjust for left 50% attribute*/
left: 50%;
margin-top: -25px; /* same idea as above */
top: 50%;
}
Boy do I feel silly… over-complicating things once again.