[Resolved] Accordion Menu Not Working After jQuery 1.9
Hello!
I'm in the process of updating a website and I am unable to resolve a problem relating to the menu.
jQuery was updated to v 1.11.0 and now the menu no longer opens and closes when clicked.
This is how it works on the existing site
Cornworthy.com
And this is the menu not working on the new preview site
Cornworthy.com Preview
The website was largely put together by someone else and my knowledge of jQuery is very limited. Despite reading the jQuery 1.9 upgrade guide I am still lost - apart from noting the depreciation of the .toggle function.
Here is the code.
- <script type="text/javascript">
$(document).ready(function(){
$('ul.menu ul').hide();
$('ul.menu').find("li.selected").parent().show();
$('ul.menu').find("li.selectedparent").parent().show();
$('ul.menu li a').not('ul ul a').click(
function() {
var checkElement = $(this).next();
var parent = this.parentNode.parentNode.id;
if($('#' + parent).hasClass('noaccordion')) {
if((String(parent).length > 0) && (String(this.className).length > 0)) {
$(this).next().slideToggle('normal');
}
}
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
if($('#' + parent).hasClass('collapsible')) {
$('#' + parent + ' ul:visible').slideUp('slow');
}
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#' + parent + ' ul:visible').slideUp('slow');
checkElement.slideDown('slow');
return false;
}
}
);
})
</script>
Can this be modified to work or is there a simpler solution?
Any ideas will be very much appreciated.
Thank you,
Chris