EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.

Home Page:https://eragonj.github.io/Trip.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Requirejs failing on Tripjs

JohnRSim opened this issue · comments

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

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

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

  • If you get a blank page and setup require and do something like this
$('#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.

@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