我看过jQuery缓解插件,但是它不适用于jQuery 1.5.1?有什么想法可以做什么,怎么办?
现在我只有一个slideToggle函数,没有缓解?
$('.open-mypage').click(function () { $('#mypage-info').slideToggle('2000',function () { // Animation complete. }); });
解决方法
.slideToggle( [ duration ],[ easing ],[ callback ] ) (version added: 1.4.3)
duration A string or number determining how long the animation will run.
easing A string indicating which easing function to use for the transition.
callback A function to call once the animation is complete.
您可以看到,有一个名为[easing]的参数,其描述是:
Easing
As of jQuery 1.4.3,an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default,called
swing
,and one that progresses at a constant pace,calledlinear
. More easing functions are available with the use of plug-ins,most notably the jQuery UI suite.
所以你有两个选择:
1)您可以使用一个可用的缓存:
$('.open-mypage').click(function () { $('#mypage-info').slideToggle('2000',"swing / linear",function () { // Animation complete. }); });
2)您的页面中包含jQuery UI并使用one of its 32 easings:
$('.open-mypage').click(function () { $('#mypage-info').slideToggle('2000',"eaSEOutBounce",function () { // Animation complete. }); });