Код |
---|
<? if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die(); if(empty($arResult)) return ; ?> <ul class="menu navigation"> <? $previousLevel = 0; $firstRoot = false; foreach($arResult as $itemIdex => $arItem):?> <?if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel):?> <?=str_repeat(" </ul></li>", ($previousLevel - $arItem["DEPTH_LEVEL"]));?> <?endif?> <?if ($arItem["IS_PARENT"]):?> <?if ($arItem["DEPTH_LEVEL"] == 1):?> <li class="<?if ($arItem["SELECTED"]):?>active<?else:?><?endif?>"> <a href="<?=$arItem["LINK"]?>" class="<?if ($arItem["SELECTED"]):?>nblock active<?else:?>nblock<?endif?>"> <?=$arItem["TEXT"]?> </a> <ul> <?else:?> <li<?if ($arItem["SELECTED"]):?> class="item-selected"<?endif?>><a href="<?=$arItem["LINK"]?>" class="parent"><?=$arItem["TEXT"]?></a> <ul> <?endif?> <?else:?> <?if ($arItem["PERMISSION"] > "D"):?> <?if ($arItem["DEPTH_LEVEL"] == 1):?> <li class="<?if ($arItem["SELECTED"]):?>active<?else:?><?endif?>"><a href="<?=$arItem["LINK"]?>" class="<?if ($arItem["SELECTED"]):?>nblock active<?else:?>nblock<?endif?>"><?=$arItem["TEXT"]?></a></li><div class="sepor"></div> <?else: if ($arItem["SELECTED"]) $class .= "item-selected"; if (!isset($arResult[$itemIdex+1]) || (isset($arResult[$itemIdex+1]) && $arResult[$itemIdex+1]["DEPTH_LEVEL"] != $arResult[$itemIdex]["DEPTH_LEVEL"])) $class .= " item-last"; if (strlen($class) > 0) $class = ' class="'.$class.'"'; ?> <li<?=$class?>><a href="<?=$arItem["LINK"]?>"><?=$arItem["TEXT"]?></a></li> <?endif?> <?else:?> <?if ($arItem["DEPTH_LEVEL"] == 1):?> <li class="<?if ($arItem["SELECTED"]):?>active<?else:?><?endif?>"><a href="" class="<?if ($arItem["SELECTED"]):?>nblock active<?else:?>nblock<?endif?>" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li> <?else:?><li><a href="" class="denied" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li><?endif?> <?endif?> <?endif; $previousLevel = $arItem["DEPTH_LEVEL"]; if ($arItem["DEPTH_LEVEL"] == 1) $firstRoot = true; ?> <?endforeach; if ($previousLevel > 1) echo str_repeat(" </ul> </li>", ($previousLevel-1)); ?> </ul> |
Код |
---|
.menucenter {border-right:1px #cfcfcf solid; width:261px; background:#f5f5f5; margin-bottom:-10px;} ul.menu, ul.menu ul {background:#f5f5f5; border-right:1px #cfcfcf solid; width:261px; list-style:none;} ul.menu a {display: block;text-decoration: none;background:url(images/bottom.png) no-repeat; width:252px; height:24px;padding-top:1px;} ul.menu li a, ul.menu ul.menu li a {background:url(images/bottom.png) no-repeat; width:252px; height:24px;padding-top:1px; } ul.menu li a:hover, ul.menu ul.menu li a:hover {/* background:url(images/bottomli.png) no-repeat; width:252px; height:24px;padding-top:1px;*/} ul.menu li ul li a, ul.menu ul.menu li ul li a {background: #f5f5f5;margin-left:20px; font: normal 13px "Trebuchet MS", Helvetica, sans-serif; text-decoration:none;color:#7c7c7c;width:240px; } ul.menu li ul li a:hover, ul.menu ul.menu li ul li a:hover {text-decoration:underline;} ul.menu a.active, ul.menu ul.menu li a.active, ul.menu a.active:hover, ul.menu ul.menu li a.active:hover {background:url(images/bottomli.png) no-repeat; width:252px; height:24px;padding-top:1px; } .sepor {background:url(images/menu_hr.png) repeat-x; height:2px; margin:0px 15px 0px 15px;} .nblock {color: #fff; font: normal 13px "Trebuchet MS", Helvetica, sans-serif; text-decoration:none; padding-left:22px;} |
Цитата |
---|
Ryuuji пишет:
При нажатии на пункт 1го уровня, из него вниз выезжает подменю 2го уровня. |
Код |
---|
<ul> <li><a href="#">Первый пункт</a> <!-- если этот li SELECTED, то ul после него показываем, иначе - не показываем --> <ul> <li>подпункт 1 </li> <li>подпункт 2</li> ... </ul> </li> </ul> |