2012-08-12 133 views
0

jQuery的动画是波涛汹涌,我(特别是在Firefox)。所以我决定用MoofX 的动画。该moofx网站给出了如何实现代码使用mooFX使用jQuery

如何实现这一代码Moofx效果(基本上replac与moofx jQuery的动画)没有明确的解释

jQuery(this).slideDown(); 

我不想切换功能。另外,如果代码保持与当前代码相似,那将会很好。

+0

阿谷歌搜索发现了一堆关于moo.fx.有用的信息这里有一个:http://www.avinashv.net/tutorials/moofx/。这使得它看起来像它的基础上的prototype.js或mootools.js框架,所以你需要这一点。 – jfriend00 2012-08-12 06:44:06

+0

页面本身说,这是过时的,它是不是我特别找 – rzr 2012-08-12 07:20:35

+0

您是否知道说MoofX jQuery的工作方式jQuery的动画更换任何文件的?我只是看到doc说它适用于prototype.js或mootools.js。 – jfriend00 2012-08-12 07:54:36

回答

1

不能完全确定,如果这是你在找什么,但你可以在一个匿名函数重写的jQuery功能。下面是一个示例重写fadeIn功能:

(function(){ 
    // storing the reference to the original function 
    var original = jQuery.fn.fadeIn; 

    // this is the actual override/replacement 
    // it has to happen before you start up jQuery 
    jQuery.fn.fadeIn= function(){ 

     // do whatever you wanna do here instead of using the original function 
     // I'm not super familiar with mooFX, but I take it's similar to MooTools 

     // This line can be entirely removed, leaving only YOUR code, in this case 
     // the MooFX effect replacing the fadeIn. If you leave it, it will run both 
     // your code and the original code 
     original.apply(this, arguments); 
    } 
})(); 

// start up jQuery 
$(function() { 
    // and code here like normal, meaning, 
    // every time you call $('#something').fadeIn({..}), it will run your code 
}); 

注意:同样,不知道这是你在找什么,我不知道如何MooFX与jQuery一起发挥出来。上面的代码仅仅是展示如何重写一个jQuery函数。