rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.29k stars 864 forks source link

Doesn't seen to work with RequireJS #105

Open KingScooty opened 11 years ago

KingScooty commented 11 years ago

I just can't seem to get this plugin to work using RequireJS. I've defined it as a module, and configured the require path and shim parameter, still get undefined when trying to use it in a module.

Any ideas?

rstacruz commented 11 years ago

Are you loading jQuery via require.js (require('jquery'))?

nok commented 11 years ago

I installed the libraries with Bower and it works fine. Try that code:

// main.js
require.config({
    paths: {
        'jquery': 'vendor/jquery/jquery.min',
        'jquery.transit': 'vendor/jquery.transit/jquery.transit'
    },
    shim: {
        'jquery.transit': {
            deps: ['jquery'],
            exports: '$'
        },
        'jquery': {
            exports: '$'
        }
    }
});
require(['app']);

// app.js
define(['jquery.transit'], function(){
    $('#box').css({ translate: [60,30] });
});