0

I made a button for my website which is a div with a background image. I animated that button using jQuery, so that when the mouse hovers the button, it jumps 20px to the right and when the mouse leaves, it goes back to previous location.

Problem is, when I zoom in (ctrl + scroll), the whole animation becomes a mess. The button moves rapidly left to right, and of course not where it supposed to be.

I used relative position and pixel unit to position the elements.

How should I position things? absolute or relative? Pixel or percent?

4

2 に答える 2

1

最善の方法は、CSS のみを使用することです。綺麗で仕事もしっかりしています。ここにデモがあります

http://jsfiddle.net/kevinPHPkevin/GyVTZ/

img {
    margin-top:20px;
}
img:hover {
    margin-top:10px;
}
于 2013-04-01T00:16:01.163 に答える