jquery - Javascript animation -


on webpage have members button animates dropdown when toggled. problem animates every time load page without clicking button cause action. open when button clicked , hidden rest of time.

the javascript using is:

$(document).ready(function() {     $('#members').animate({         margintop: '-80px'     }, 0);      $('.mem').toggle( function() {         $('#members').animate({             margintop: '0'         }, 500);     },     function() {         $('#members').animate({         margintop: '-80px'         }, 500);     }); }); 

as can see first animates div -80px. want -80px without having animate every time load page.

thanks!

to #members css class, add that:

display:none; 

i updated javascript:

$(document).ready(function() {     $('#members').css({         margintop: '-80px'     });     $('.mem').toggle(function(){         $('#members').css({             display: 'block'         });         $('#members').animate({             margintop: '0'         }, 500);     },     function(){         $('#members').animate({             margintop: '-80px'         }, 500);     }); }); 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -