One advantage of being old is that my first thought when I saw your error message was "Hmm... Is the $() function really what you think it is?" :-)
You see, jQuery's $() function never, ever returns null or undefined. Nor does jQuery() if you call it under that name. Even if you give it a selector that doesn't match any elements, it returns an empty jQuery object—much like [], an empty array—rather than nothing.
So the only way you could get this error:
Cannot call method 'waypoint' of null
on this line of code:
$('.container').waypoint('sticky');
would be if $ is not the jQuery function. Because that's what that error is saying: you're trying to call null.waypoint(). The only way that can happen is if the $('.container') call returns null.
And indeed this is the case: You are loading both jQuery and Prototype.js, and at the point where you hit the error, you are calling Prototype's version of the $ function.
Here, try this: Load your page in Chrome with the developer tools open. It should stop on that .waypoint() call.
Now, hit Esc to open the mini-console (or click the Console tab at the top of the developer tools), and type this into the console:
$
It will display:
function $(element) {
if (arguments.length > 1) {
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push($(arguments[i]));
return elements;
}
if (Object.isString(element))
element = document.getElementById(element);
return Element.extend(element);
}
Now type this:
jQuery
and it will display:
function (e,t){return new v.fn.init(e,t,n)}
Definitely not the same function!
Or for a simple test, type:
$ === jQuery
and it prints:
false
Oops.
To fix this, you will probably need to use jQuery's noConflict() feature so you can use both jQuery and Prototype together. Here's an excellent writeup on the topic:
Avoiding Conflicts with Other Libraries
(Thanks to @acdcjunior for the reference!)
BTW, the multiple versions of jQuery are not related to this issue. Do you really need to load both 1.8.2 and 1.8.3, though? What's the difference between those two that's causing a compatibility issue?
**here**.waypointis not what you think it is.