You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3. $('.inactive').click(function(){
  4. var className=$(this).parents('li').parents().attr('class');
  5. if($(this).siblings('ul').css('display')=='none')
  6. {
  7. if(className=="leftmenu")
  8. {
  9. $(this).parents('li').siblings('li').children('ul').parent('li').children('a').removeClass('active');
  10. $(this).parents('li').siblings('li').children('ul').slideUp(100);
  11. $(this).parents('li').children('ul').children('li').children('ul').parent('li').children('a').removeClass('active');
  12. $(this).parents('li').children('ul').children('li').children('ul').slideUp(100);
  13. }
  14. $(this).addClass('active');
  15. $(this).siblings('ul').slideDown(100);
  16. }
  17. else
  18. {
  19. $(this).removeClass('active');
  20. $(this).siblings('ul').slideUp(100);
  21. }
  22. });
  23. $('.active').trigger("click");
  24. });
  25. </script>
  26. <div class="menu">
  27. <ul class="leftmenu">
  28. <?php if($menus){ foreach($menus as $k=>$first){ ?>
  29. <!-- 一级菜单 -->
  30. <li><a href="<?php if(isset($first['child'])){echo 'javascript:;';}else{echo route($first['action']);} ?>" class="<?php if(isset($first['child'])){echo 'inactive ';} if($k==0){echo 'active ';} ?>"><?php if($first['icon']){echo '<small class="'.$first['icon'].'"></small>';} ?> <?php echo $first['name']; ?></a>
  31. <!-- 二级菜单 -->
  32. <?php if(isset($first['child'])){ ?>
  33. <ul style="display: none">
  34. <?php foreach($first['child'] as $second){ ?>
  35. <li><a target="appiframe" href="<?php if(isset($second['child'])){echo 'javascript:;';}else{echo route($second['action']);} ?>" class="<?php if(isset($second['child'])){echo 'inactive ';} ?>"><small class="glyphicon glyphicon-triangle-right"></small> <?php echo $second['name']; ?></a>
  36. <!-- 三级菜单 -->
  37. <?php if(isset($second['child'])){ ?>
  38. <ul><?php foreach($second['child'] as $third){ ?>
  39. <li><a target="appiframe" href="{{ route($third['action']) }}"><small class="glyphicon glyphicon-menu-right"></small> <?php echo $third['name']; ?></a></li><?php } ?>
  40. </ul><?php } ?>
  41. </li>
  42. <?php } ?>
  43. </ul><?php } ?>
  44. </li>
  45. <?php }} ?>
  46. </ul>
  47. </div>