Advertisement
otfromtot

Untitled

Apr 5th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.62 KB | None | 0 0
  1. searchShowOnHover: function() {
  2.            
  3.             var mainCont = this;
  4.             var searchCont = mainCont.children('#search');
  5.             var isHovered = false;
  6.            
  7.             //// WHEN WE HOVER IT
  8.             mainCont.hover(function() {
  9.                
  10.                 isHovered = true;
  11.                
  12.                 /// CALCULATES THE HEIGHT OF THE SEARCH
  13.                 var searchHeight = searchCont.outerHeight();
  14.                 var actualHeight = searchHeight + 70;
  15.                
  16.                 //// ANIMATES THE HEIGHT
  17.                 mainCont.stop().animate({ height: actualHeight+'px' }, { easing: 'easeInOutCubic', duration: 300 });
  18.                
  19.                 mainCont.find('.up-arrow, .down-arrow').stop().animate({ opacity: 0 }, 250);
  20.                
  21.             }, function() {
  22.                    
  23.                 var unHover = true;
  24.                 isHovered = false;
  25.                    
  26.                 //// IF WE HAVE A SELECT OPEN
  27.                 if(mainCont.find('select:focus').length > 0 && navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
  28.                    
  29.                     unHover = false;
  30.                    
  31.                     jQuery('#search-spots').one('submit', function() {
  32.                
  33.                         //// ANIMATES THE HEIGHT
  34.                         mainCont.stop().animate({ height: '70px' }, { easing: 'easeInOutCubic', duration: 300 });
  35.                        
  36.                         mainCont.find('.up-arrow, .down-arrow').stop().animate({ opacity: 1 }, 250);
  37.                        
  38.                     });
  39.                    
  40.                 }
  41.                    
  42.                 if(jQuery('.pac-container').length > 0) {
  43.                    
  44.                     if(jQuery('.pac-container').is(':visible')) { unHover = false; }   
  45.                
  46.                 }
  47.                
  48.                 //// IF ITS NOT HOVERED
  49.                 if(unHover) {
  50.            
  51.                     //// ANIMATES THE HEIGHT
  52.                     mainCont.stop().animate({ height: '70px' }, { easing: 'easeInOutCubic', duration: 300 });
  53.                    
  54.                     mainCont.find('.up-arrow, .down-arrow').stop().animate({ opacity: 1 }, 250);
  55.                    
  56.                 }
  57.                
  58.             });
  59.            
  60.         },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement