After click on menu button menu open on left side but when click on More all ul has opened. I want only related UL will open. Please Help i am fresher in Jquery.....

After click on menu button menu open on left side but when click on More all ul has opened. I want only related UL will open. Please Help i am fresher in Jquery.....


  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  2. <script>
  3. $(document).ready(function(e) {
  4.    $("button.menu-open").click(function(){
  5. $("body").addClass("stickmenu");
  6. });
  7. $("button.menu-close").click(function(){
  8. $("body").removeClass("stickmenu");
  9. });
  10. var kvd = "ul>li:has(ul)";
  11. $(kvd).addClass("parent-item").prepend("<div class='buttonlink'>More</div>");
  12. $(".buttonlink").click(function(){
  13. $("ul>li").closest('ul').find('ul').toggle('slow');
  14. });
  15. });
  16. </script>
  17. <style>
  18. body{transition:padding ease 1s; -webkit-transition:padding ease 0.5s;}
  19. .stickmenu{padding-left:250px}
  20. .fixedmenu{width:250px; top:0; left:0; opacity:0; display:none; position:absolute; top:0; bottom:0; background-color:#333; color:#FFF}
  21. .stickmenu .fixedmenu{opacity:1; display:block}

  22. ul>li.parent-item > ul{display:none}
  23. </style>
  24. <button class="menu-open">Menu</button>
  25. <div class="fixedmenu">
  26. <button class="menu-close">Menu Close</button>
  27. <ul>
  28. <li><a href="#">tab 1</a></li>
  29. <li><a href="#">tab 2</a>
  30. <ul>
  31. <li><a href="#">tab 2.1</a></li>
  32. <li><a href="#">tab 2.2</a></li>
  33. <li><a href="#">tab 2.3</a></li>
  34. </ul>
  35. </li>
  36. <li><a href="#">tab 3</a>
  37. <ul>
  38. <li><a href="#">tab 3.1</a></li>
  39. <li><a href="#">tab 3.2</a></li>
  40. <li><a href="#">tab 3.3</a></li>
  41. </ul>
  42. </li>
  43. </ul>
  44. </div>
  45. <div id="div1">
  46. <p> theis is dsfds dsfdsl ldjfds didfdf idfdo dfdf dfoifj  dfdof erer rerlr</p>
  47. <p> theis is dsfds dsfdsl ldjfds didfdf idfdo dfdf dfoifj  dfdof erer rerlr</p>

  48. </div>