Uncaught TypeError: Cannot call method 'css' of null (anonymous function) – Joomla 1.5-Collection of common programming errors
On your spa website, the file js/cookielaw.js
is not called, indeed it is invoked by relative url and /spa/js/cookielaw.js
return a 404 error, so no code are loaded.
On your other website (about cars), the url is absolute : /scc/js/cookielaw.js
so the script is loaded.
The issue is that DOM is not ready when you call that script, so jQuery return the error.
Try to change begin of script from :
// Cookie Law
// -----------------------------------------------------------------------------
$('html').css('padding-top','35px');
$('.cookiedisclaimer').show();
(function($) {
//...
to
// Cookie Law
// -----------------------------------------------------------------------------
(function($) {
$('html').css('padding-top','35px');
$('.cookiedisclaimer').show();
//...
It’s the easier and faster way to fix.
A cleaner way is to start your script like that :
// Cookie Law
// -----------------------------------------------------------------------------
$(document).ready(function() {
$('html').css('padding-top','35px');
$('.cookiedisclaimer').show();
}) ;
(function($) {
//...