如何在 jQuery 插件 jQuery.ScrollTo 中使用缓动?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4710438/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use easing in the jQuery plugin jQuery.ScrollTo?
提问by alexchenco
回答by David Tang
The examples are here: http://demos.flesler.com/jquery/scrollTo/
示例在这里:http: //demos.flesler.com/jquery/scrollTo/
Use like so:
像这样使用:
$.scrollTo( '#options-examples', 800, {easing:'easeOutQuad'} );
These easing functions don't come built in though. You can use the jQuery Easing plugin. This then supplies the following easing functions:
不过,这些缓动函数不是内置的。您可以使用jQuery Easing 插件。然后提供以下缓动函数:
- jswing
- easeInQuad
- easeOutQuad
- easeInOutQuad
- easeInCubic
- easeOutCubic
- easeInOutCubic
- easeInQuart
- easeOutQuart
- easeInOutQuart
- easeInQuint
- easeOutQuint
- easeInOutQuint
- easeInSine
- easeOutSine
- easeInOutSine
- easeInExpo
- easeOutExpo
- easeInOutExpo
- easeInCirc
- easeOutCirc
- easeInOutCirc
- easeInElastic
- easeOutElastic
- easeInOutElastic
- easeInBack
- easeOutBack
- easeInOutBack
- easeInBounce
- easeOutBounce
- easeInOutBounce
- jswing
- 轻松四边形
- 缓出四边形
- 缓入四出
- 立方体
- 缓出立方
- 缓入出立方
- 轻松四分
- 缓出季度
- 缓入四出
- 轻松自在
- 缓出昆特
- 缓入输出
- 随心所欲
- 缓出正弦
- 缓入缓出
- 世博会
- 缓出世博会
- 缓入出口博览会
- 缓入循环
- 缓出循环
- 缓入外循环
- 缓入弹性
- 缓出弹性
- 缓入缓出弹性
- 缓入后退
- 缓出后退
- 缓出后退
- 缓入弹跳
- 缓出弹跳
- 缓入缓出
回答by Adi Nugraha Y
You can find the default usage here: http://gsgd.co.uk/sandbox/jquery/easing/
您可以在此处找到默认用法:http: //gsgd.co.uk/sandbox/jquery/easing/
Here is an example of 'easeOutQuad':
这是“easeOutQuad”的示例:
function (){
jQuery.easing.def = 'easeOutQuad';
$('#options-examples').on('click','a', function() {
$('#another-option-examples').slideToggle(1000);
return false;
});
}