EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
https://eragonj.github.io/Trip.js/
MIT License
793 stars 111 forks source link

Requirejs failing on Tripjs #169

Open JohnRSim opened 8 years ago

JohnRSim commented 8 years ago

require([ 'pathTo/trip.js' ], function(Trip) { console.log(Trip); });

Trip is undefined in console.log - however Trip.js is loaded on page. Using requirejs 2.3.0 and tripjs 3.3.3

EragonJ commented 8 years ago

@jdorfman plz check how i use it here in the official site of Trip.js - http://eragonj.github.io/Trip.js/js/demo.js

JohnRSim commented 8 years ago

Hi Eragon - I've been looking at that and playing and think something is wrong. You define and load tripjs outside of requirejs first and then load it in again as part of requirejs within the document.js

$('#blah').on('click', function() {
    require([
        'http://eragonj.github.io/Trip.js/vendor/trip.js/trip.min.js'
    ], function(Trip) {
        // ...
        console.log(Trip);
    });
});

You will see Trip is undefined etc and error on constructor.

However if you load trip and define it - it works fine.

EragonJ commented 8 years ago

@JohnRSim Trip.js is dependent on jQuery, did you also handle that path in your requirejs configuration ? https://github.com/EragonJ/Trip.js/blob/master/dist/trip.js#L19