Im new to Javascript and jquery and I almost have my problem solved. I built an accordion menu that in some versions of IE is bad, I mean, Im sure its bad overall, but it stops all Javascript on the page from working if its called first. Im guessing its some syntax thing I dont know and therefore cant find.
// JavaScript Document
function initiateMenu() {
var pathname = window.location;
console.log( window.location.pathname );
$('.sub').hide();
$("#menu a[href='"+pathname+"']").next().show();
$("#menu a[href='"+pathname+"']").parents('.sub').show();
$("ul.sub").parent().prepend("<span></span>");
$('#menu li span').click(
function() {
var checkElement = $(this).parent().find("ul.sub");
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initiateMenu();});
I cant see what is wrong with the script but its stopping all other Javascript from working.
If i call it after other scripts on the page the other scripts work. Please help If you need to look at the page its http://www.jardencustom.com/2012/
The home page has the accordion script moved below the other scripts, the rest do not.