2

I'm using the following code for a simple JQuery accordion menu which uses JQuery 1.4

The issue is that I'm also using mmenu which requires JQuery 1.7 or higher in order to function and so the two are now conflicting.

Can I therefore update the following code to make it JQuery 1.7 friendly? Are there any other recommendations?

Thanks all for your help - much appreciated...

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script type="text/javascript" src="js/jquery.cookie.js"></script>

<script>
$(document).ready(function () {
  var checkCookie = $.cookie("nav123-item");
  if (checkCookie != "") {
    $('#nav123 > li > a:eq('+checkCookie+')').addClass('active').next().show();
  }
  $('#nav123 > li > a').click(function(){
      var nav123Index = $('#nav123 > li > a').index(this);
      $.cookie("nav123-item", nav123Index);
      $('#nav123 li ul').slideUp();
       if ($(this).next().is(":visible")){
           $(this).next().slideUp();
       } else {
       $(this).next().slideToggle();
       }
       $('#nav123 li a').removeClass('active');
       $(this).addClass('active');
  });
});
</script>
isonome
  • 83
  • 1
  • 1
  • 7
  • 2
    Have you tried running that code with jQuery 1.7? Also, I'd advise you to get new scripts that run the latest version of jQuery. – Styphon Mar 26 '15 at 16:11

1 Answers1

2

You can run multiple jQuery versions in noconflict mode, just wrap your code like this:

(function($) { 
    /*your code here*/ 
}(jquery_x_x_x)); // jquery_1_4_1 for example

HERE is more info.

Community
  • 1
  • 1
Danijel
  • 12,408
  • 5
  • 38
  • 54