简体   繁体   中英

Jquery animation hover

In my website i have an image that when hover it goes up using this.

HTML

<div class="first">
<a href="#dialogdemo" name="modal"><img src="images/1sticon.png" alt=" " border="0"/></a>
    <div class="support">
    <img src="images/orpan.png" alt=" " />
    </div>
</div>

Jquery

 $('.first img').hover(
   function(){
    $(this).stop().animate({marginTop:'-25px',}, 300);  
   },
   function(){
    $(this).stop().animate({marginTop:'0px',}, 300);
   }
);

but i have another image at the back of it that when hover i want the image above it to stay on its place and when mouseout it the 1st image above will go down to cover the image under it (back image).

I dont understand fully what your requirement is but I think you can use .live() of jquery to achieve what you want

$('.support1 img').live('mouseenter',function(){
    "your code"
}).live('mouseleave',function(){
    "your code"
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM