jQuery Uncaught TypeError: Property '$' of object [object Window] is not a function in Wordpress javascript

In Wordpress and other CMS systems that use multiple javascript libraries, when this error occurs after you put your Jquery in no conflict mode is caused by missing the "$" symbol in the parentheses. For example, here is the original code that you wrote:


$(document).ready(function() {
var aboveHeight = $('header').outerHeight();
$(window).scroll(function(){
if ($(window).scrollTop() > aboveHeight){
$('#main-menu').addClass('fixed').css('top','0').next().css('padding-top','60px');
} else {
$('#main-menu').removeClass('fixed').next().css('padding-top','0');
}
});
});​

To convert to no conflict mode, you'll quickly change the initial dollar sign to "jQuery" like so:


jQuery(document).ready(function() {
var aboveHeight = $('header').outerHeight();
$(window).scroll(function(){
if ($(window).scrollTop() > aboveHeight){
$('#main-menu').addClass('fixed').css('top','0').next().css('padding-top','60px');
} else {
$('#main-menu').removeClass('fixed').next().css('padding-top','0');
}
});
});​

However it will cause this error: jQuery Uncaught TypeError: Property '$' of object [object Window] is not a function which means that you forgot to put the variable of $ into the parentheses of the function like so:


jQuery(document).ready(function($) {
var aboveHeight = $('header').outerHeight();
$(window).scroll(function(){
if ($(window).scrollTop() > aboveHeight){
$('#main-menu').addClass('fixed').css('top','0').next().css('padding-top','60px');
} else {
$('#main-menu').removeClass('fixed').next().css('padding-top','0');
}
});
});​

After that you should be all set.