jQuery animate function not animating properly -


i'm new jquery (and programming in general.) trying to create filter function mobile site , having trouble. hidden div comes view when clicking 'filter by..' button. working fine except. button needs animate rest of div. can go down, not again. here's code.

css:

#filter_button{     display:none;     z-index:499;     width:75px;     left:60%;     height:75px;     border:solid 2px green;     border-radius:250px;     background-color:#fff;     top:-25px;     position:fixed;  }  @media screen , (max-width:730px){         #filter_button{             display:block;         } } 

jquery:

  $('#filter_button').on('click', function(){       $('#mobile_filter').slidetoggle();          var div1height = $('#filters').height()+$('#vehicle').height();         var div2height = div1height+$('#categories').height();          if ($('#mobile_filter').css('display')== 'none'){              $('#filter_button').animate({top:-25});          }else{            $('#filter_button').animate({top:div2height-5});         }     }); 

any appreciated.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -