开发者

make an image animate from one point to another? (pic attached)

开发者 https://www.devze.com 2023-03-21 22:14 出处:网络
To be a little more exact, I created a graphic describing my query: Basically, I have a circular logo. When the user hovers over it, I want an image 开发者_高级运维of a person\'s face to pop up, or

To be a little more exact, I created a graphic describing my query:

make an image animate from one point to another? (pic attached)

Basically, I have a circular logo. When the user hovers over it, I want an image 开发者_高级运维of a person's face to pop up, or rather move up with some animation. Is this something I can get done with css3? Or perhaps there is another method?


it is possible in jquery, but you will have to use a rectangular image for the circle (i.e. square with a hole in the middle). it would be structured somewhat like this:

<div id="logoContainer" style="position:relative; overflow:hidden">
  <img src="Box_With_Hole.png" style="position:absolute; left:0px; top:0px;">
  <img src="Man_With_Shiny_Head.png" style="position:absolute; left:0px; top:100%;">
</div>

to transition you could use JQuery

$("#logoContainer").hover(function(){$(this).stop().animate({
    top: "0%"
  }, 1000);
  $(this).stop().animate({
    top: "100%"
  }, 1000);
});

untested though

EDIT: animation code may me sketchy :P

0

精彩评论

暂无评论...
验证码 换一张
取 消