需要帮助以突出显示导航栏上的当前类别。我怎样才能做到这一点?我真的很感激一些帮助。感谢。
答案 0 :(得分:0)
-mtime != -ctime
这个CSS会为你做的。
答案 1 :(得分:0)
您需要找到链接的页面ID: 例如:
<a href="link_to_id"<?php if ($page_id == $link_to_id) { echo ' class="active"'; } ?>>Link</a>
的CSS:
a.active {
font-color: red;
}
答案 2 :(得分:0)
您的0级菜单CSS与1级菜单CSS冲突
尝试更改#nav ul li a:active{}
答案 3 :(得分:0)
@MichaelEugeneYuen
这是我的top.phtml
文件,我添加了
<li <?php if (Mage::helper('core/url')->getCurrentUrl() === $this->getUrl('Offers')):?>class="active"<?php endif;?>><a href="<?php echo $this->getUrl('contacts')?>">Offers</a></li>
但我不知道它是否正确放置
<?php
/**
* Top menu for store
*
* @see Mage_Catalog_Block_Navigation
*/
?>
<?php
/**
* $this->renderCategoriesMenuHtml() supports optional arguments:
* int Level number for list item class to start from
* string Extra class of outermost list items
* string If specified wraps children list in div with this class
*/
?>
<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
<?php if($_menu): ?>
<script>
$j(document).ready(function(){
$j('#nav').mobileMenu();
});
</script>
<div class="nav-container">
<ul id="nav">
<li <?php if (Mage::helper('core/url')->getCurrentUrl() === $this->getUrl('Offers')):?>class="active"<?php endif;?>><a href="<?php echo $this->getUrl('contacts')?>">Offers</a></li>
<?php echo $_menu ?>
</ul>
</div>
<?php endif ?>
另外,我已将你给我的CSS代码添加到0级的Style.css
/* 0 Level */
#nav li {
float: left;
padding: 5px 17px 10px 0;
}
ul#nav{padding-left:0px }
#nav a { font-size:18px!important;
color: #666666 !important;
float: left;
padding-left: 5px;
font-family: 'futura_lt_btlight'; !important;
font-weight:normal !important;
li:active a { font-color: red; }
}
.subcategories {
padding-left: 0px !important;
margin-right: 0px !important;
}
#mc-embedded-subscribe {
float: left;
width: 11px;
background: url(https://www.blubond.com/wp-content/uploads/2015/01/cross.png) no-repeat !important;
height: 11px;
color: rgba(0, 0, 0, 0);
text-indent: 9999px;
border: 0px !important;
margin-top: 7px;
margin-left: 5px;
box-shadow: none;
}
#nav > li:nth-child(3) {
background: url("../images/main_menu_dd_arw.png") no-repeat 100% 15px;
margin-right: 16px;
}
.post-entry center {
font-family: 'futura_lt_btlight';
font-size: 18px;
line-height: 24px;
}
.page-template-blog-excerpt-php .post {
margin-bottom: 60px;
}
.page-template-blog-excerpt-php .post-entry {
font-family: 'futura_lt_btlight';
font-size: 18px;
line-height: 24px !important;
}
.page-template-blog-excerpt-php .post-entry p {
margin-bottom: 0px;
}
.page-template-blog-excerpt-php .post-data {
margin-top: 0px;
}
.nav-collapse a {
text-align: left;
}
.rdiregdrop
{
background: url("../images/top_dd_arw-3.png") repeat scroll 0 0 rgba(0, 0, 0, 0);
display: block;
float:right;
height: 5px;
margin-left: 0;
margin-right: 6px;
margin-top: 11px;
width:9px;
}
#nav li.over a,
#nav a:hover { color:#9f9f9f;}
.rdishopdd{display: block;float:right;height:5px;width:9px;display:none; margin-left: 5px;
margin-top: 10px;}
.rdishopdd:hover{background: url("../images/main_menu_dd_arw.png") repeat scroll 0 0 rgba(0, 0, 0, 0); display: block;float:right;height:5px;width:9px;display:block;margin-left: 5px;
margin-top: 10px;}