Moh*_*mad 8 javascript jquery scroll easing-functions jquery-easing
使用此代码,我已经能够捕获鼠标滚轮移动并将其应用于水平滚动条而不是垂直默认值.
$('html').bind('mousewheel', function(event, delta) {
window.parent.scrollBy(-120 * delta, 0);
return false;
});
Run Code Online (Sandbox Code Playgroud)
有什么方法可以将这个jQuery缓动动画添加到滚动运动中吗?
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.extend( jQuery.easing, {
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
});
Run Code Online (Sandbox Code Playgroud)
非常感谢你提前!
我认为你需要的是scrollTo插件。似乎符合要求,虽然我个人没有使用过。基本上应该可以这样调用
$.scrollTo( -120*delta, {duration:1000,easing:'easeInOutBack',axis:'x'} )
Run Code Online (Sandbox Code Playgroud)
在这里找到插件演示。jquery插件站点目前似乎处于离线状态,但是当其备份时,可以在此处找到该插件
| 归档时间: |
|
| 查看次数: |
1877 次 |
| 最近记录: |