set jquery default animation speed

后端 未结 2 1627
天涯浪人
天涯浪人 2021-02-14 04:00

I cannot find any documentation. All I want to do it set jQuerys default animation speed. Something like this:

 $.setDefaultAnimationSpeed = 5000; //does not wor         


        
2条回答
  •  太阳男子
    2021-02-14 04:45

    i dont think there is any such thing in jquery but you can try something like this

     defaultAnimationSpeed = 5000;  // declare a global variable
    
     $('elem').fadeIn(defaultAnimationSpeed); 
     $('elem').animate({foo : bar}, defaultAnimationSpeed);
    

    So that it will be applicable wherever it is used and also you can change it very easily. you need not change everywhere in animation.

提交回复
热议问题