Good afternoon, the question is.

I write a function animating the block, the speed is passed to it by the parameter. The default animation is as follows:

animate({opacity: 'show', height: 'show'}, parseInt(settings.speed)) 

How correctly to provide possibility to select animation only slide or only fade through parameters?



    1 answer 1

     function yourAnimFunc(settings){ $('selector')[settings.animType](parseInt(settings.speed)); } 

    and pass to your function:

     yourAnimFunc({animType: 'fadeIn', speed: '1000'});