Mootools + Uncaught ReferenceError: _ is not defined

395 views
Skip to first unread message

Benjamin Hammond

unread,
Feb 18, 2014, 3:15:13 PM2/18/14
to mootool...@googlegroups.com

This site was working fine until I changed servers. Since then, some of the elements controlled by Mootools have suddenly stopped working (a subtle parallax effect being the main one).

When I inspect the problem, I seem to get an awful lot of these:
Uncaught ReferenceError: _ is not defined

I haven't changed any of the code / location of files / order in which items are called.

I've been searching for a solution for a while. Any suggestions welcome.

Sanford Whiteman

unread,
Feb 18, 2014, 3:22:33 PM2/18/14
to Benjamin Hammond
> When I inspect the problem, I seem to get an awful lot of these:
> Uncaught ReferenceError: _ is not defined

Surely this is because Underscore (a different, complimentary JS
framework) is not being loaded, not Moo.

That in turn seems to be because RequireJS isn't finding it.

Where do you see underscore on the server?

-- Sandy



Benjamin Hammond

unread,
Feb 18, 2014, 3:55:25 PM2/18/14
to mootool...@googlegroups.com
Hey Sandy,

Thanks for the tip. I looked into the underscore file and for some reason the code was missing within the .js file. Very strange.
But now I've replaced the code, the site seems to be very jittery whilst scrolling. Do you think that this might be a Mootools issue?

Sanford Whiteman

unread,
Feb 18, 2014, 4:13:04 PM2/18/14
to Benjamin Hammond
> Thanks for the tip. I looked into the underscore file and for some
> reason the code was missing within the .js file. Very strange.

Yes indeed.

> But now I've replaced the code, the site seems to be very jittery
> whilst scrolling. Do you think that this might be a Mootools issue?

Hard to say. You've got 2 heavyweight frameworks loading (jQuery and
MooTools) and classes for each... it's certainly possible that you
have multiple scrolling hooks all firing and that would definitely
mess things up. Without an actual error message you could be wasting a
lot of cycles scrolling and rescrolling an element, but not so much
that the browser sees high CPU, for example. My workstation is
(half-purposely) so old that it doesn't look so off to me. :)

You're going to have to break down the code and see when the scrolling
problems start.

-- S.


Benjamin Hammond

unread,
Feb 18, 2014, 4:20:25 PM2/18/14
to mootool...@googlegroups.com
I think you may be right!

Wish me luck ;-)

And thanks for your help.


On Tuesday, February 18, 2014 9:15:13 PM UTC+1, Benjamin Hammond wrote:
Reply all
Reply to author
Forward
0 new messages