In this Topmenu i have a custom home-link and some other CMS-links i insert through a Static Block.
How can i give those CMS-page menu items an active
class?
--- Update 1 ---
I found this answer, but i can't get it to work?
I adjust app\design\frontend\mypackage\mytheme\template\page\html\topmenu.phtml
like this:
<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<nav id="nav">
<ol class="nav-primary">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-link')->toHtml(); ?>
<?php echo $_menu ?>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('main-cms-links')->toHtml(); ?>
</ol>
</nav>
<script>
var currentPageId = '';
<?php if (Mage::getSingleton('cms/page')): ?>
currentPageId = '<?php echo Mage::getSingleton('cms/page')->getIdentifier(); ?>'
<?php endif; ?>
if (jQuery('#'+currentPageId).is('li')) {
jQuery('#'+currentPageId).addClass('active');
}
</script>
<?php endif ?>