在没有加载库的情况下使用jQuery UI功能

时间:2012-04-19 18:03:23

标签: javascript jquery jquery-ui jquery-plugins

我正在尝试从jQuery UI中使用一些缓动函数,而不必完全加载UI库。

参考资料来源:jQuery easing functions without using a plugin

$.extend($.easing,
{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert($.easing.default);
        return $.easing[$.easing.def](x, t, b, c, d);
    },
    easeInQuad: function (x, t, b, c, d) {
        return c*(t/=d)*t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c*(t/=d)*t*t + b;
    }
});


$(function(){
    (function(){
        $('#the_ribbon').animate({
            top: '+=140',
          }, 1000, function() {
            //Consume an easing function here.
          });
    })();   

});

特别是我希望能够像弹跳一样消耗效果,不确定是否会缓和(不必包含UI文件)。

如何从UI源引用和使用这些内容?

0 个答案:

没有答案