Jquery if not working
I have this code .. the problem is that the CSS is not being applied in both divs but only in the first #main-wrapper
      
        
        
        
      
    
I have the same code, but this time on a button click and its working, but with the if statement only one works .. im not sure if the codes are wrong somewhere, please help ... I tried to install the script at the end body tag but still nothing
if (window.location.href.indexOf("#expand") > -1) {
  $( "#main-wrapper" ).animate({ 'width':'984px' }, 'slow');
  $( "#sidebar-wrapper" ).animate({ 'display':'none' }, 'slow');   
}
      
        
        
        
      
     
+3 
user2656018 
source
to share
      
1 answer
      
        
        
        
      
    
You cannot animate 'display':'none'
      
        
        
        
      
    .
You can animate the opacity:
$( "#sidebar-wrapper" ).animate({'opacity':0}, 'slow', function(){
    $(this).remove();
});
      
        
        
        
      
    
or, as suggested by Me.Name in the comments:
$( "#sidebar-wrapper" ).fadeOut('slow');
      
        
        
        
      
    
or use slideUp
      
        
        
        
      
    :
$( "#sidebar-wrapper" ).slideUp();
      
        
        
        
      
     
+6 
Denys Sรฉguret 
source
to share