Complicated jQuery .hover Work
        Posted  
        
            by Paul Herz
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Paul Herz
        
        
        
        Published on 2010-05-15T06:52:45Z
        Indexed on 
            2010/05/15
            6:54 UTC
        
        
        Read the original article
        Hit count: 438
        
The following code is giving me a lot of trouble. To note, .hover changes the background image. Firstly, how can I combine the two with .hover rather than a separate mouseenter and mouseleave? Second, How can I make it so that while the div is shifting upwards, the background image is simultaneously fading?
$('div.designbox.orangehello').mouseenter(function() {
   $('div.designbox.orangehello').animate({
     top: '-=10',
   }, 55, function() {
     $(this).addClass('hover');
   });
 });
 $('div.designbox.orangehello').mouseleave(function() {
   $('div.designbox.orangehello').animate({
     top: '+=10',
   }, 55, function() {
     $(this).removeClass('hover');
   });
 });
        © Stack Overflow or respective owner