Nessuna descrizione
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.

menu.js 1016B

1234567891011121314151617181920212223242526272829303132333435363738
  1. $(document).ready(function(){
  2. function unfoldMenu(pn, cn){
  3. var p = $('strong.menu-p'), c = $('div.menu-c'), cc = $('div.menu-c-current');
  4. if(c.index(cn) != c.index(cc)){
  5. p.removeClass('menu-p-current');
  6. cc.hide(200, function(){
  7. $(this).removeAttr('style').removeClass('menu-c-current');
  8. })
  9. pn.addClass('menu-p-current');
  10. cn.show(200, function(){
  11. $(this).removeAttr('style').addClass('menu-c-current');
  12. });
  13. }
  14. }
  15. function menuHandle(){
  16. $('strong.menu-p').click(function(){
  17. var pn = $(this), cn = pn.next();
  18. unfoldMenu(pn, cn);
  19. });
  20. }
  21. //设置默认下当前展开
  22. function menuCurrent(){
  23. var idx = $('input.menu-code-index').val(), m, pn, cn, p = $('strong.menu-p'), c = $('div.menu-c'), cc = $('div.menu-c-current');
  24. if(/c(\d)+/.test(idx)){ //判断c(十进制)条件
  25. m = $('a[data-service-index="' + idx + '"]').addClass('current');
  26. cn = m.parents('div.menu-c');
  27. pn = cn.prev();
  28. unfoldMenu(pn, cn);
  29. }
  30. }
  31. menuCurrent();
  32. menuHandle();
  33. });