Menu Jquery dynamique


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. #/{app}/views/elements/menu.tcp
  3. ?>
  4.  
  5. <?php foreach($menus as $menuL1): ?>
  6. <div id="<?php echo $menuL1['Menu']['id'] ?>" class="D-Link-Header">
  7. <?php echo '| '.$menuL1['Menu']['labelmenu']; ?>
  8. </div>
  9. <div id="<?php echo $menuL1['Menu']['id'] ?>-Link-Items" class="D-Link-Item">
  10. <ul>
  11. <?php foreach($menuL1['Ssmenu'] as $menuL22): ?>
  12.  
  13. <li><a href="#"><?php echo $menuL22['ssmenu']; ?></a></li>
  14.  
  15. <?php endforeach; ?>
  16. </ul>
  17. </div>
  18. <?php endforeach; ?>
  19.  
  20. <script type="text/javascript">
  21. $(document).ready(function(){
  22. $(".D-Link-Item").hide();
  23. $(".D-Link-Header").click (function() {
  24. if ($("#"+$(this).attr("id")+"-Link-Items").is(":hidden")){
  25. $(".D-Link-Item").hide("fast");
  26. $("#"+$(this).attr("id")+"-Link-Items").show("fast");
  27. }
  28. });
  29. });
  30. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.