Page 1 of 1

[Solved] jQuery Menu Broken

Posted: Sat Apr 11, 2015 6:42 pm
by apollo9
Our site is being updated, and as a result of using a newer version of jQuery, 1.9+, the existing accordion menu has broken.
My best guess is that it's to do with .slideToggle command.
Does anyone know how to fix this because I'm stuck?

Code: Select all

<__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>

Re: jQuery Menu Broken

Posted: Sat Apr 11, 2015 9:34 pm
by paulbaker
URL would probably help here. And define what you mean by broken - doesn't work at all? Some aspect doesn't do what it used to do? What updating to the site is being done...CMSMS version update? More clues = more chance of solution.

Re: jQuery Menu Broken

Posted: Sat Apr 11, 2015 11:30 pm
by apollo9
This is how the menu currently works. (The old site is still live until the new one is working). cmsms 1.11.9. jquery 1.7.2.
http://cornworthy.com/cms

The new site is running 1.11.13 and if I use jquery 1.9.0 or higher the menu fails to open and close when clicked.
http://cornworthy.com.gridhosted.co.uk/cms/

I've updated other scripts which is why I'm using a different jquery version.

Re: jQuery Menu Broken

Posted: Sat Apr 11, 2015 11:36 pm
by calguy1000
HINT1: View your javascript console and resolve errors. Then see what other stuff is broken.

HINT2: Read the jquery 1.9 upgrade guide.

[edit]
HINT3: Get your HTML to validate.

Re: jQuery Menu Broken

Posted: Sun Apr 12, 2015 12:45 am
by apollo9
Thanks for the suggestions. Think I'm out of my depth here - will take another look.

Re: jQuery Menu Broken

Posted: Sun Apr 12, 2015 5:26 pm
by apollo9
It was colorbox causing the problem! Also needed an update.
Thanks again.