jquery - 如何将 css3 过渡缓动转换为 jquery 缓动函数?

标签 jquery css css-transitions easing

我也为现代浏览器和旧浏览器制作了一个 slider 。我使用 translate3d 和 transition 在支持 css3 的现代浏览器中制作动画。我为旧浏览器使用 2d top、left 和 easing 函数。我从这里开始使用 css3 缓动:

http://matthewlein.com/ceaser/

我想将它转换为 javascript 函数以便在旧浏览器上使用。我知道那里有很多缓动函数,但我只想知道如何转换。可能吗?

最佳答案

您可以使用 jQuery Bez jQuery 中的 Cubic Bezier Easings 插件:

演示:http://jsfiddle.net/SO_AMK/sbZ7a/

jQuery:

$("#box").click(function() {
    $(this).animate({
        "margin-left": 200
    }, 2000, $.bez([0.685, 0.595, 0.020, 0.720]));
});

// Take the Ceaser output and put the values in, in order, like above. i.e. cubic-bezier(0.685, 0.595, 0.020, 0.720) would end up as the above value​

插件:https://github.com/rdallasgray/bez

关于jquery - 如何将 css3 过渡缓动转换为 jquery 缓动函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12449887/

相关文章:

JQuery:滚动时在 anchor 上切换类

javascript - 如果没有返回JSON数据则AJAX成功函数

CSS 媒体查询在 IE 9 中不起作用

html - Div 内联 block 元素未正确填充宽度

当代码是顺序的时,CSS3 转换不起作用

javascript - 根据值更改 <td> <i> CSS

javascript - 如何将文件附加到 html 'file' 元素以使用 jquery/js 上传?

CSS 下拉菜单在悬停时捕捉/调整大小

css - 如何将显示 CSS 过渡延迟应用于子 div

html - 过渡 - 无法获得旋转和更改边距顶部值的跨度