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.....
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- <script>
- $(document).ready(function(e) {
- $("button.menu-open").click(function(){
- $("body").addClass("stickmenu");
- });
- $("button.menu-close").click(function(){
- $("body").removeClass("stickmenu");
- });
-
- var kvd = "ul>li:has(ul)";
- $(kvd).addClass("parent-item").prepend("<div class='buttonlink'>More</div>");
- $(".buttonlink").click(function(){
- $("ul>li").closest('ul').find('ul').toggle('slow');
- });
- });
- </script>
- <style>
- body{transition:padding ease 1s; -webkit-transition:padding ease 0.5s;}
- .stickmenu{padding-left:250px}
- .fixedmenu{width:250px; top:0; left:0; opacity:0; display:none; position:absolute; top:0; bottom:0; background-color:#333; color:#FFF}
- .stickmenu .fixedmenu{opacity:1; display:block}
- ul>li.parent-item > ul{display:none}
- </style>
- <button class="menu-open">Menu</button>
- <div class="fixedmenu">
- <button class="menu-close">Menu Close</button>
- <ul>
- <li><a href="#">tab 1</a></li>
- <li><a href="#">tab 2</a>
- <ul>
- <li><a href="#">tab 2.1</a></li>
- <li><a href="#">tab 2.2</a></li>
- <li><a href="#">tab 2.3</a></li>
- </ul>
- </li>
- <li><a href="#">tab 3</a>
- <ul>
- <li><a href="#">tab 3.1</a></li>
- <li><a href="#">tab 3.2</a></li>
- <li><a href="#">tab 3.3</a></li>
- </ul>
- </li>
- </ul>
- </div>
- <div id="div1">
- <p> theis is dsfds dsfdsl ldjfds didfdf idfdo dfdf dfoifj dfdof erer rerlr</p>
- <p> theis is dsfds dsfdsl ldjfds didfdf idfdo dfdf dfoifj dfdof erer rerlr</p>
- </div>