Keyword

Creating Active 'Menu' item css highlight for K2 content module

  • Alan Sparkes
  • Alan Sparkes's Avatar Topic Author
  • Offline
  • Premium Member
More
14 years 5 months ago #81891 by Alan Sparkes
Want active menu item css styles for your K2 module content items?Here is how;Open default.php (mod_k2_content/tmpl/Default/default.php)Add this just afetr line 13 :<?php  //check url for K2 and get id to pass to loop to create active css class   (JRequest::getVar('option') == 'com_k2') ? $k2id = JRequest::getVar('id') : $k2id ="";?>On line 22 change this:    <li class="<?php echo ($key%2) ? "odd" : "even"; ?>">      to this:     <li id="" class="<?php echo ($key%2) ? "odd" : "even"; ?> <?php  echo ($k2id == $item->id.':'.$item->alias) ? "active" : "" ; ?>">Note we are just adding a space to the class and adding another class. You can then adjust your style sheets like so:.k2ItemsBlock ul li.active a {font-weight:bold;color:red}Now you have active item highlighting!

Please Log in or Create an account to join the conversation.

More
14 years 5 months ago #81892 by vtiger
Usefull.

Thanks
LN

Please Log in or Create an account to join the conversation.

More
14 years 5 days ago #81893 by Manos
Hi, is it possible to provide a file with the modifications?

Thanks

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #81894 by Mark Law
Thanks Alan, this should be included in the core for sure!

 

An essential addition to K2, many thanks :)

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #81895 by Willy Wong
This doesn't work for me. Anyone could guide me on this? Thank you.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum